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