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