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