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