1 /* Script for --shared -z combreloc: shared library, combine & sort relocs */ 2 OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", 3 "elf32-tradlittlemips") 4 OUTPUT_ARCH(mips) 5 ENTRY(__start) 6 SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); 7 /* Do we need any of these for elf? 8 __DYNAMIC = 0; */ 9 SECTIONS 10 { 11 /* Read-only sections, merged into text segment: */ 12 . = 0 + SIZEOF_HEADERS; 13 .reginfo : { *(.reginfo) } 14 .dynamic : { *(.dynamic) } 15 .hash : { *(.hash) } 16 .dynsym : { *(.dynsym) } 17 .dynstr : { *(.dynstr) } 18 .gnu.version : { *(.gnu.version) } 19 .gnu.version_d : { *(.gnu.version_d) } 20 .gnu.version_r : { *(.gnu.version_r) } 21 .rel.dyn : 22 { 23 *(.rel.init) 24 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) 25 *(.rel.fini) 26 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) 27 *(.rel.data.rel.ro*) 28 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) 29 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) 30 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) 31 *(.rel.ctors) 32 *(.rel.dtors) 33 *(.rel.got) 34 *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) 35 *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) 36 *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) 37 *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) 38 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) 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 } 58 .rel.plt : { *(.rel.plt) } 59 .rela.plt : { *(.rela.plt) } 60 .init : 61 { 62 KEEP (*(.init)) 63 } =0 64 .plt : { *(.plt) } 65 .text : 66 { 67 _ftext = . ; 68 *(.text .stub .text.* .gnu.linkonce.t.*) 69 KEEP (*(.text.*personality*)) 70 /* .gnu.warning sections are handled specially by elf32.em. */ 71 *(.gnu.warning) 72 *(.mips16.fn.*) *(.mips16.call.*) 73 } =0 74 .fini : 75 { 76 KEEP (*(.fini)) 77 } =0 78 PROVIDE (__etext = .); 79 PROVIDE (_etext = .); 80 PROVIDE (etext = .); 81 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 82 .rodata1 : { *(.rodata1) } 83 .eh_frame_hdr : { *(.eh_frame_hdr) } 84 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 85 .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } 86 /* Adjust the address for the data segment. We want to adjust up to 87 the same address within the page on the next page up. */ 88 . = ALIGN (0x40000) - ((0x40000 - .) & (0x40000 - 1)); . = DATA_SEGMENT_ALIGN (0x40000, 0x1000); 89 /* Exception handling */ 90 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 91 .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } 92 /* Thread Local Storage sections */ 93 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 94 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 95 /* Ensure the __preinit_array_start label is properly aligned. We 96 could instead move the label definition inside the section, but 97 the linker would then create the section even if it turns out to 98 be empty, which isn't pretty. */ 99 . = ALIGN(32 / 8); 100 .preinit_array : { KEEP (*(.preinit_array)) } 101 .init_array : { KEEP (*(.init_array)) } 102 .fini_array : { KEEP (*(.fini_array)) } 103 .ctors : 104 { 105 /* gcc uses crtbegin.o to find the start of 106 the constructors, so we make sure it is 107 first. Because this is a wildcard, it 108 doesn't matter if the user does not 109 actually link against crtbegin.o; the 110 linker won't look for a file to match a 111 wildcard. The wildcard also means that it 112 doesn't matter which directory crtbegin.o 113 is in. */ 114 KEEP (*crtbegin*.o(.ctors)) 115 /* We don't want to include the .ctor section from 116 from the crtend.o file until after the sorted ctors. 117 The .ctor section from the crtend file contains the 118 end of ctors marker and it must be last */ 119 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) 120 KEEP (*(SORT(.ctors.*))) 121 KEEP (*(.ctors)) 122 } 123 .dtors : 124 { 125 KEEP (*crtbegin*.o(.dtors)) 126 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) 127 KEEP (*(SORT(.dtors.*))) 128 KEEP (*(.dtors)) 129 } 130 .jcr : { KEEP (*(.jcr)) } 131 .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } 132 . = DATA_SEGMENT_RELRO_END (0, .); 133 .data : 134 { 135 _fdata = . ; 136 *(.data .data.* .gnu.linkonce.d.*) 137 KEEP (*(.gnu.linkonce.d.*personality*)) 138 SORT(CONSTRUCTORS) 139 } 140 .data1 : { *(.data1) } 141 HIDDEN (_gp = ALIGN(16) + 0x7ff0); 142 .got : { *(.got.plt) *(.got) } 143 .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } 144 .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } 145 /* We want the small data sections together, so single-instruction offsets 146 can access them all, and initialized data all before uninitialized, so 147 we can shorten the on-disk segment size. */ 148 .sdata : 149 { 150 *(.sdata .sdata.* .gnu.linkonce.s.*) 151 } 152 .lit8 : { *(.lit8) } 153 .lit4 : { *(.lit4) } 154 _edata = .; 155 PROVIDE (edata = .); 156 __bss_start = .; 157 _fbss = .; 158 .sbss : 159 { 160 PROVIDE (__sbss_start = .); 161 PROVIDE (___sbss_start = .); 162 *(.dynsbss) 163 *(.sbss .sbss.* .gnu.linkonce.sb.*) 164 *(.scommon) 165 PROVIDE (__sbss_end = .); 166 PROVIDE (___sbss_end = .); 167 } 168 .bss : 169 { 170 *(.dynbss) 171 *(.bss .bss.* .gnu.linkonce.b.*) 172 *(COMMON) 173 /* Align here to ensure that the .bss section occupies space up to 174 _end. Align after .bss to ensure correct alignment even if the 175 .bss section disappears because there are no input sections. */ 176 . = ALIGN(. != 0 ? 32 / 8 : 1); 177 } 178 . = ALIGN(32 / 8); 179 _end = .; 180 PROVIDE (end = .); 181 . = DATA_SEGMENT_END (.); 182 /* Stabs debugging sections. */ 183 .stab 0 : { *(.stab) } 184 .stabstr 0 : { *(.stabstr) } 185 .stab.excl 0 : { *(.stab.excl) } 186 .stab.exclstr 0 : { *(.stab.exclstr) } 187 .stab.index 0 : { *(.stab.index) } 188 .stab.indexstr 0 : { *(.stab.indexstr) } 189 .comment 0 : { *(.comment) } 190 /* DWARF debug sections. 191 Symbols in the DWARF debugging sections are relative to the beginning 192 of the section so we begin them at 0. */ 193 /* DWARF 1 */ 194 .debug 0 : { *(.debug) } 195 .line 0 : { *(.line) } 196 /* GNU DWARF 1 extensions */ 197 .debug_srcinfo 0 : { *(.debug_srcinfo) } 198 .debug_sfnames 0 : { *(.debug_sfnames) } 199 /* DWARF 1.1 and DWARF 2 */ 200 .debug_aranges 0 : { *(.debug_aranges) } 201 .debug_pubnames 0 : { *(.debug_pubnames) } 202 /* DWARF 2 */ 203 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 204 .debug_abbrev 0 : { *(.debug_abbrev) } 205 .debug_line 0 : { *(.debug_line) } 206 .debug_frame 0 : { *(.debug_frame) } 207 .debug_str 0 : { *(.debug_str) } 208 .debug_loc 0 : { *(.debug_loc) } 209 .debug_macinfo 0 : { *(.debug_macinfo) } 210 /* SGI/MIPS DWARF 2 extensions */ 211 .debug_weaknames 0 : { *(.debug_weaknames) } 212 .debug_funcnames 0 : { *(.debug_funcnames) } 213 .debug_typenames 0 : { *(.debug_typenames) } 214 .debug_varnames 0 : { *(.debug_varnames) } 215 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } 216 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } 217 /DISCARD/ : { *(.note.GNU-stack) *(.MIPS.abiflags) } 218 } 219