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