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