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