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