1 /* Script for ld -pie: link position independent executable */ 2 OUTPUT_FORMAT("elf32-ntradbigmips", "elf32-ntradbigmips", 3 "elf32-ntradlittlemips") 4 OUTPUT_ARCH(mips) 5 ENTRY(__start) 6 SECTIONS 7 { 8 /* Read-only sections, merged into text segment: */ 9 PROVIDE (__executable_start = 0); . = 0 + SIZEOF_HEADERS; 10 .interp : { *(.interp) } 11 .MIPS.abiflags : { *(.MIPS.abiflags) } 12 .reginfo : { *(.reginfo) } 13 .note.gnu.build-id : { *(.note.gnu.build-id) } 14 .dynamic : { *(.dynamic) } 15 .hash : { *(.hash) } 16 .gnu.hash : { *(.gnu.hash) } 17 .dynsym : { *(.dynsym) } 18 .dynstr : { *(.dynstr) } 19 .gnu.version : { *(.gnu.version) } 20 .gnu.version_d : { *(.gnu.version_d) } 21 .gnu.version_r : { *(.gnu.version_r) } 22 .rel.init : { *(.rel.init) } 23 .rela.init : { *(.rela.init) } 24 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 25 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 26 .rel.fini : { *(.rel.fini) } 27 .rela.fini : { *(.rela.fini) } 28 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 29 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 30 .rel.data.rel.ro : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) } 31 .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) } 32 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 33 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 34 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 35 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 36 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 37 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 38 .rel.ctors : { *(.rel.ctors) } 39 .rela.ctors : { *(.rela.ctors) } 40 .rel.dtors : { *(.rel.dtors) } 41 .rela.dtors : { *(.rela.dtors) } 42 .rel.got : { *(.rel.got) } 43 .rela.got : { *(.rela.got) } 44 .rel.dyn : { *(.rel.dyn) } 45 .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } 46 .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } 47 .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } 48 .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } 49 .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } 50 .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } 51 .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } 52 .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } 53 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 54 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 55 .rel.iplt : 56 { 57 PROVIDE_HIDDEN (__rel_iplt_start = .); 58 *(.rel.iplt) 59 PROVIDE_HIDDEN (__rel_iplt_end = .); 60 } 61 .rela.iplt : 62 { 63 PROVIDE_HIDDEN (__rela_iplt_start = .); 64 *(.rela.iplt) 65 PROVIDE_HIDDEN (__rela_iplt_end = .); 66 } 67 .rel.plt : 68 { 69 *(.rel.plt) 70 } 71 .rela.plt : 72 { 73 *(.rela.plt) 74 } 75 .init : 76 { 77 KEEP (*(SORT_NONE(.init))) 78 } 79 .plt : { *(.plt) } 80 .iplt : { *(.iplt) } 81 .text : 82 { 83 _ftext = . ; 84 *(.text.unlikely .text.*_unlikely .text.unlikely.*) 85 *(.text.exit .text.exit.*) 86 *(.text.startup .text.startup.*) 87 *(.text.hot .text.hot.*) 88 *(.text .stub .text.* .gnu.linkonce.t.*) 89 /* .gnu.warning sections are handled specially by elf32.em. */ 90 *(.gnu.warning) 91 *(.mips16.fn.*) *(.mips16.call.*) 92 } 93 .fini : 94 { 95 KEEP (*(SORT_NONE(.fini))) 96 } 97 PROVIDE (__etext = .); 98 PROVIDE (_etext = .); 99 PROVIDE (etext = .); 100 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 101 .rodata1 : { *(.rodata1) } 102 .sdata2 : 103 { 104 *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) 105 } 106 .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } 107 .eh_frame_hdr : { *(.eh_frame_hdr) } 108 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 109 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table 110 .gcc_except_table.*) } 111 /* These sections are generated by the Sun/Oracle C++ compiler. */ 112 .exception_ranges : ONLY_IF_RO { *(.exception_ranges 113 .exception_ranges*) } 114 /* Adjust the address for the data segment. For 32 bits we want to align 115 at exactly a page boundary to make life easier for apriori. */ 116 . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); 117 /* Exception handling */ 118 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 119 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 120 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } 121 /* Thread Local Storage sections */ 122 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 123 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 124 /* Ensure the __preinit_array_start label is properly aligned. We 125 could instead move the label definition inside the section, but 126 the linker would then create the section even if it turns out to 127 be empty, which isn't pretty. */ 128 . = ALIGN(32 / 8); 129 PROVIDE_HIDDEN (__preinit_array_start = .); 130 .preinit_array : 131 { 132 KEEP (*(.preinit_array)) 133 } 134 PROVIDE_HIDDEN (__preinit_array_end = .); 135 PROVIDE_HIDDEN (__init_array_start = .); 136 .init_array : 137 { 138 KEEP (*crtbegin*.o(.init_array)) 139 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 140 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .ctors)) 141 } 142 PROVIDE_HIDDEN (__init_array_end = .); 143 PROVIDE_HIDDEN (__fini_array_start = .); 144 .fini_array : 145 { 146 KEEP (*crtbegin*.o(.fini_array)) 147 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 148 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .dtors)) 149 } 150 PROVIDE_HIDDEN (__fini_array_end = .); 151 .ctors : 152 { 153 /* gcc uses crtbegin.o to find the start of 154 the constructors, so we make sure it is 155 first. Because this is a wildcard, it 156 doesn't matter if the user does not 157 actually link against crtbegin.o; the 158 linker won't look for a file to match a 159 wildcard. The wildcard also means that it 160 doesn't matter which directory crtbegin.o 161 is in. */ 162 KEEP (*crtbegin.o(.ctors)) 163 KEEP (*crtbegin*.o(.ctors)) 164 /* We don't want to include the .ctor section from 165 the crtend.o file until after the sorted ctors. 166 The .ctor section from the crtend file contains the 167 end of ctors marker and it must be last */ 168 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors)) 169 KEEP (*(SORT(.ctors.*))) 170 KEEP (*(.ctors)) 171 } 172 .dtors : 173 { 174 KEEP (*crtbegin.o(.dtors)) 175 KEEP (*crtbegin*.o(.dtors)) 176 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors)) 177 KEEP (*(SORT(.dtors.*))) 178 KEEP (*(.dtors)) 179 } 180 .jcr : { KEEP (*(.jcr)) } 181 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } 182 . = DATA_SEGMENT_RELRO_END (0, .); 183 .data : 184 { 185 _fdata = . ; 186 *(.data .data.* .gnu.linkonce.d.*) 187 SORT(CONSTRUCTORS) 188 } 189 .data1 : { *(.data1) } 190 .got.plt : { *(.got.plt) } 191 . = .; 192 . = .; 193 HIDDEN (_gp = ALIGN (16) + 0x7ff0); 194 .got : { *(.got) } 195 /* We want the small data sections together, so single-instruction offsets 196 can access them all, and initialized data all before uninitialized, so 197 we can shorten the on-disk segment size. */ 198 .sdata : 199 { 200 *(.sdata .sdata.* .gnu.linkonce.s.*) 201 } 202 .lit8 : { *(.lit8) } 203 .lit4 : { *(.lit4) } 204 .srdata : { *(.srdata) } 205 _edata = .; PROVIDE (edata = .); 206 . = .; 207 __bss_start = .; 208 _fbss = .; 209 .sbss : 210 { 211 *(.dynsbss) 212 *(.sbss .sbss.* .gnu.linkonce.sb.*) 213 *(.scommon) 214 } 215 .bss : 216 { 217 *(.dynbss) 218 *(.bss .bss.* .gnu.linkonce.b.*) 219 *(COMMON) 220 /* Align here to ensure that the .bss section occupies space up to 221 _end. Align after .bss to ensure correct alignment even if the 222 .bss section disappears because there are no input sections. */ 223 . = ALIGN(32 / 8); 224 } 225 . = ALIGN(32 / 8); 226 . = SEGMENT_START("ldata-segment", .); 227 . = ALIGN(32 / 8); 228 _end = .; 229 _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; 230 PROVIDE (end = .); 231 . = DATA_SEGMENT_END (.); 232 /* Stabs debugging sections. */ 233 .stab 0 : { *(.stab) } 234 .stabstr 0 : { *(.stabstr) } 235 .stab.excl 0 : { *(.stab.excl) } 236 .stab.exclstr 0 : { *(.stab.exclstr) } 237 .stab.index 0 : { *(.stab.index) } 238 .stab.indexstr 0 : { *(.stab.indexstr) } 239 .comment 0 : { *(.comment) } 240 /* DWARF debug sections. 241 Symbols in the DWARF debugging sections are relative to the beginning 242 of the section so we begin them at 0. */ 243 /* DWARF 1 */ 244 .debug 0 : { *(.debug) } 245 .line 0 : { *(.line) } 246 /* GNU DWARF 1 extensions */ 247 .debug_srcinfo 0 : { *(.debug_srcinfo) } 248 .debug_sfnames 0 : { *(.debug_sfnames) } 249 /* DWARF 1.1 and DWARF 2 */ 250 .debug_aranges 0 : { *(.debug_aranges) } 251 .debug_pubnames 0 : { *(.debug_pubnames) } 252 /* DWARF 2 */ 253 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 254 .debug_abbrev 0 : { *(.debug_abbrev) } 255 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } 256 .debug_frame 0 : { *(.debug_frame) } 257 .debug_str 0 : { *(.debug_str) } 258 .debug_loc 0 : { *(.debug_loc) } 259 .debug_macinfo 0 : { *(.debug_macinfo) } 260 /* SGI/MIPS DWARF 2 extensions */ 261 .debug_weaknames 0 : { *(.debug_weaknames) } 262 .debug_funcnames 0 : { *(.debug_funcnames) } 263 .debug_typenames 0 : { *(.debug_typenames) } 264 .debug_varnames 0 : { *(.debug_varnames) } 265 /* DWARF 3 */ 266 .debug_pubtypes 0 : { *(.debug_pubtypes) } 267 .debug_ranges 0 : { *(.debug_ranges) } 268 /* DWARF Extension. */ 269 .debug_macro 0 : { *(.debug_macro) } 270 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 271 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } 272 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } 273 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) } 274 } 275