| [444] | 1 | /* | 
|---|
|  | 2 | * The common part of the default linker scripts for standalone | 
|---|
|  | 3 | * executables running on a Moxie processor. | 
|---|
|  | 4 | * | 
|---|
|  | 5 | * Copyright (C) 2008, 2012 Anthony Green | 
|---|
|  | 6 | * | 
|---|
|  | 7 | * The authors hereby grant permission to use, copy, modify, | 
|---|
|  | 8 | * distribute, and license this software and its documentation for any | 
|---|
|  | 9 | * purpose, provided that existing copyright notices are retained in | 
|---|
|  | 10 | * all copies and that this notice is included verbatim in any | 
|---|
|  | 11 | * distributions. No written agreement, license, or royalty fee is | 
|---|
|  | 12 | * required for any of the authorized uses. Modifications to this | 
|---|
|  | 13 | * software may be copyrighted by their authors and need not follow | 
|---|
|  | 14 | * the licensing terms described here, provided that the new terms are | 
|---|
|  | 15 | * clearly indicated on the first page of each file where they apply. | 
|---|
|  | 16 | */ | 
|---|
|  | 17 |  | 
|---|
|  | 18 | OUTPUT_FORMAT("elf32-bigmoxie", "elf32-bigmoxie", | 
|---|
|  | 19 | "elf32-littlemoxie") | 
|---|
|  | 20 | OUTPUT_ARCH(moxie) | 
|---|
|  | 21 | ENTRY(_start) | 
|---|
|  | 22 | SECTIONS | 
|---|
|  | 23 | { | 
|---|
|  | 24 | /* Read-only sections, merged into text segment: */ | 
|---|
|  | 25 | . = 0x00001000; | 
|---|
|  | 26 | .interp     : { *(.interp)    } | 
|---|
|  | 27 | .hash          : { *(.hash)           } | 
|---|
|  | 28 | .dynsym        : { *(.dynsym)         } | 
|---|
|  | 29 | .dynstr        : { *(.dynstr)         } | 
|---|
|  | 30 | .gnu.version   : { *(.gnu.version)    } | 
|---|
|  | 31 | .gnu.version_d   : { *(.gnu.version_d)        } | 
|---|
|  | 32 | .gnu.version_r   : { *(.gnu.version_r)        } | 
|---|
|  | 33 | .rel.init      : { *(.rel.init)       } | 
|---|
|  | 34 | .rela.init     : { *(.rela.init)      } | 
|---|
|  | 35 | .rel.text      : | 
|---|
|  | 36 | { | 
|---|
|  | 37 | *(.rel.text) | 
|---|
|  | 38 | *(.rel.text.*) | 
|---|
|  | 39 | *(.rel.gnu.linkonce.t*) | 
|---|
|  | 40 | } | 
|---|
|  | 41 | .rela.text     : | 
|---|
|  | 42 | { | 
|---|
|  | 43 | *(.rela.text) | 
|---|
|  | 44 | *(.rela.text.*) | 
|---|
|  | 45 | *(.rela.gnu.linkonce.t*) | 
|---|
|  | 46 | } | 
|---|
|  | 47 | .rel.fini      : { *(.rel.fini)       } | 
|---|
|  | 48 | .rela.fini     : { *(.rela.fini)      } | 
|---|
|  | 49 | .rel.rodata    : | 
|---|
|  | 50 | { | 
|---|
|  | 51 | *(.rel.rodata) | 
|---|
|  | 52 | *(.rel.rodata.*) | 
|---|
|  | 53 | *(.rel.gnu.linkonce.r*) | 
|---|
|  | 54 | } | 
|---|
|  | 55 | .rela.rodata   : | 
|---|
|  | 56 | { | 
|---|
|  | 57 | *(.rela.rodata) | 
|---|
|  | 58 | *(.rela.rodata.*) | 
|---|
|  | 59 | *(.rela.gnu.linkonce.r*) | 
|---|
|  | 60 | } | 
|---|
|  | 61 | .rel.data      : | 
|---|
|  | 62 | { | 
|---|
|  | 63 | *(.rel.data) | 
|---|
|  | 64 | *(.rel.data.*) | 
|---|
|  | 65 | *(.rel.gnu.linkonce.d*) | 
|---|
|  | 66 | } | 
|---|
|  | 67 | .rela.data     : | 
|---|
|  | 68 | { | 
|---|
|  | 69 | *(.rela.data) | 
|---|
|  | 70 | *(.rela.data.*) | 
|---|
|  | 71 | *(.rela.gnu.linkonce.d*) | 
|---|
|  | 72 | } | 
|---|
|  | 73 | .rel.ctors     : { *(.rel.ctors)      } | 
|---|
|  | 74 | .rela.ctors    : { *(.rela.ctors)     } | 
|---|
|  | 75 | .rel.dtors     : { *(.rel.dtors)      } | 
|---|
|  | 76 | .rela.dtors    : { *(.rela.dtors)     } | 
|---|
|  | 77 | .rel.got       : { *(.rel.got)                } | 
|---|
|  | 78 | .rela.got      : { *(.rela.got)               } | 
|---|
|  | 79 | .rel.sdata     : | 
|---|
|  | 80 | { | 
|---|
|  | 81 | *(.rel.sdata) | 
|---|
|  | 82 | *(.rel.sdata.*) | 
|---|
|  | 83 | *(.rel.gnu.linkonce.s*) | 
|---|
|  | 84 | } | 
|---|
|  | 85 | .rela.sdata     : | 
|---|
|  | 86 | { | 
|---|
|  | 87 | *(.rela.sdata) | 
|---|
|  | 88 | *(.rela.sdata.*) | 
|---|
|  | 89 | *(.rela.gnu.linkonce.s*) | 
|---|
|  | 90 | } | 
|---|
|  | 91 | .rel.sbss      : { *(.rel.sbss)               } | 
|---|
|  | 92 | .rela.sbss     : { *(.rela.sbss)      } | 
|---|
|  | 93 | .rel.bss       : { *(.rel.bss)                } | 
|---|
|  | 94 | .rela.bss      : { *(.rela.bss)               } | 
|---|
|  | 95 | .rel.plt       : { *(.rel.plt)                } | 
|---|
|  | 96 | .rela.plt      : { *(.rela.plt)               } | 
|---|
|  | 97 | .plt      : { *(.plt) } | 
|---|
|  | 98 | .text      : | 
|---|
|  | 99 | { | 
|---|
|  | 100 | *(.text) | 
|---|
|  | 101 | *(.text.*) | 
|---|
|  | 102 | *(.stub) | 
|---|
|  | 103 | /* .gnu.warning sections are handled specially by elf32.em.  */ | 
|---|
|  | 104 | *(.gnu.warning) | 
|---|
|  | 105 | *(.gnu.linkonce.t*) | 
|---|
|  | 106 | *(.glue_7t) *(.glue_7) | 
|---|
|  | 107 | } =0 | 
|---|
|  | 108 | .init          : | 
|---|
|  | 109 | { | 
|---|
|  | 110 | KEEP (*(.init)) | 
|---|
|  | 111 | } =0 | 
|---|
|  | 112 | _etext = .; | 
|---|
|  | 113 | PROVIDE (etext = .); | 
|---|
|  | 114 | .fini      : | 
|---|
|  | 115 | { | 
|---|
|  | 116 | KEEP (*(.fini)) | 
|---|
|  | 117 | } =0 | 
|---|
|  | 118 | .rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } | 
|---|
|  | 119 | .rodata1   : { *(.rodata1) } | 
|---|
|  | 120 | .eh_frame_hdr : { *(.eh_frame_hdr) } | 
|---|
|  | 121 | /* Adjust the address for the data segment.  We want to adjust up to | 
|---|
|  | 122 | the same address within the page on the next page up.  */ | 
|---|
|  | 123 | . = ALIGN(256) + (. & (256 - 1)); | 
|---|
|  | 124 | .data    : | 
|---|
|  | 125 | { | 
|---|
|  | 126 | *(.data) | 
|---|
|  | 127 | *(.data.*) | 
|---|
|  | 128 | *(.gnu.linkonce.d*) | 
|---|
|  | 129 | SORT(CONSTRUCTORS) | 
|---|
|  | 130 | } | 
|---|
|  | 131 | .data1   : { *(.data1) } | 
|---|
|  | 132 | .eh_frame : { KEEP (*(.eh_frame)) } | 
|---|
|  | 133 | .gcc_except_table : { *(.gcc_except_table) } | 
|---|
|  | 134 | .ctors   : | 
|---|
|  | 135 | { | 
|---|
|  | 136 | /* gcc uses crtbegin.o to find the start of | 
|---|
|  | 137 | the constructors, so we make sure it is | 
|---|
|  | 138 | first.  Because this is a wildcard, it | 
|---|
|  | 139 | doesn't matter if the user does not | 
|---|
|  | 140 | actually link against crtbegin.o; the | 
|---|
|  | 141 | linker won't look for a file to match a | 
|---|
|  | 142 | wildcard.  The wildcard also means that it | 
|---|
|  | 143 | doesn't matter which directory crtbegin.o | 
|---|
|  | 144 | is in.  */ | 
|---|
|  | 145 | KEEP (*crtbegin.o(.ctors)) | 
|---|
|  | 146 | /* We don't want to include the .ctor section from | 
|---|
|  | 147 | from the crtend.o file until after the sorted ctors. | 
|---|
|  | 148 | The .ctor section from the crtend file contains the | 
|---|
|  | 149 | end of ctors marker and it must be last */ | 
|---|
|  | 150 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) | 
|---|
|  | 151 | KEEP (*(SORT(.ctors.*))) | 
|---|
|  | 152 | KEEP (*(.ctors)) | 
|---|
|  | 153 | } | 
|---|
|  | 154 | .dtors         : | 
|---|
|  | 155 | { | 
|---|
|  | 156 | KEEP (*crtbegin.o(.dtors)) | 
|---|
|  | 157 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) | 
|---|
|  | 158 | KEEP (*(SORT(.dtors.*))) | 
|---|
|  | 159 | KEEP (*(.dtors)) | 
|---|
|  | 160 | } | 
|---|
|  | 161 | .jcr            : { KEEP (*(.jcr)) } | 
|---|
|  | 162 | .got           : { *(.got.plt) *(.got) } | 
|---|
|  | 163 | .dynamic       : { *(.dynamic) } | 
|---|
|  | 164 | /* We want the small data sections together, so single-instruction offsets | 
|---|
|  | 165 | can access them all, and initialized data all before uninitialized, so | 
|---|
|  | 166 | we can shorten the on-disk segment size.  */ | 
|---|
|  | 167 | .sdata     : | 
|---|
|  | 168 | { | 
|---|
|  | 169 | *(.sdata) | 
|---|
|  | 170 | *(.sdata.*) | 
|---|
|  | 171 | *(.gnu.linkonce.s.*) | 
|---|
|  | 172 | } | 
|---|
|  | 173 | _edata = .; | 
|---|
|  | 174 | PROVIDE (edata = .); | 
|---|
|  | 175 | __bss_start = .; | 
|---|
|  | 176 | __bss_start__ = .; | 
|---|
|  | 177 | .sbss      : | 
|---|
|  | 178 | { | 
|---|
|  | 179 | *(.dynsbss) | 
|---|
|  | 180 | *(.sbss) | 
|---|
|  | 181 | *(.sbss.*) | 
|---|
|  | 182 | *(.scommon) | 
|---|
|  | 183 | } | 
|---|
|  | 184 | .bss       : | 
|---|
|  | 185 | { | 
|---|
|  | 186 | *(.dynbss) | 
|---|
|  | 187 | *(.bss) | 
|---|
|  | 188 | *(.bss.*) | 
|---|
|  | 189 | *(COMMON) | 
|---|
|  | 190 | /* Align here to ensure that the .bss section occupies space up to | 
|---|
|  | 191 | _end.  Align after .bss to ensure correct alignment even if the | 
|---|
|  | 192 | .bss section disappears because there are no input sections.  */ | 
|---|
|  | 193 | . = ALIGN(32 / 8); | 
|---|
|  | 194 | } | 
|---|
|  | 195 | . = ALIGN(32 / 8); | 
|---|
|  | 196 | _end = .; | 
|---|
|  | 197 | _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; | 
|---|
|  | 198 | PROVIDE (end = .); | 
|---|
|  | 199 | /* Stabs debugging sections.  */ | 
|---|
|  | 200 | .stab 0 : { *(.stab) } | 
|---|
|  | 201 | .stabstr 0 : { *(.stabstr) } | 
|---|
|  | 202 | .stab.excl 0 : { *(.stab.excl) } | 
|---|
|  | 203 | .stab.exclstr 0 : { *(.stab.exclstr) } | 
|---|
|  | 204 | .stab.index 0 : { *(.stab.index) } | 
|---|
|  | 205 | .stab.indexstr 0 : { *(.stab.indexstr) } | 
|---|
|  | 206 | .comment 0 : { *(.comment) } | 
|---|
|  | 207 | /* DWARF debug sections. | 
|---|
|  | 208 | Symbols in the DWARF debugging sections are relative to the beginning | 
|---|
|  | 209 | of the section so we begin them at 0.  */ | 
|---|
|  | 210 | /* DWARF 1 */ | 
|---|
|  | 211 | .debug          0 : { *(.debug) } | 
|---|
|  | 212 | .line           0 : { *(.line) } | 
|---|
|  | 213 | /* GNU DWARF 1 extensions */ | 
|---|
|  | 214 | .debug_srcinfo  0 : { *(.debug_srcinfo) } | 
|---|
|  | 215 | .debug_sfnames  0 : { *(.debug_sfnames) } | 
|---|
|  | 216 | /* DWARF 1.1 and DWARF 2 */ | 
|---|
|  | 217 | .debug_aranges  0 : { *(.debug_aranges) } | 
|---|
|  | 218 | .debug_pubnames 0 : { *(.debug_pubnames) } | 
|---|
|  | 219 | /* DWARF 2 */ | 
|---|
|  | 220 | .debug_info     0 : { *(.debug_info) } | 
|---|
|  | 221 | .debug_abbrev   0 : { *(.debug_abbrev) } | 
|---|
|  | 222 | .debug_line     0 : { *(.debug_line) } | 
|---|
|  | 223 | .debug_frame    0 : { *(.debug_frame) } | 
|---|
|  | 224 | .debug_str      0 : { *(.debug_str) } | 
|---|
|  | 225 | .debug_loc      0 : { *(.debug_loc) } | 
|---|
|  | 226 | .debug_macinfo  0 : { *(.debug_macinfo) } | 
|---|
|  | 227 | .debug_ranges   0 : { *(.debug_ranges) } | 
|---|
|  | 228 | /* SGI/MIPS DWARF 2 extensions */ | 
|---|
|  | 229 | .debug_weaknames 0 : { *(.debug_weaknames) } | 
|---|
|  | 230 | .debug_funcnames 0 : { *(.debug_funcnames) } | 
|---|
|  | 231 | .debug_typenames 0 : { *(.debug_typenames) } | 
|---|
|  | 232 | .debug_varnames  0 : { *(.debug_varnames) } | 
|---|
|  | 233 | .stack 0x400000 : { _stack = .; *(.stack) } | 
|---|
|  | 234 | /* These must appear regardless of  .  */ | 
|---|
|  | 235 | } | 
|---|