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