boot.ldscript revision 1.1
1/* Script for -N: mix text and data on same page; don't align data */ 2OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", 3 "elf32-tradlittlemips") 4OUTPUT_ARCH(mips) 5ENTRY(__start) 6SEARCH_DIR("=/usr/lib"); 7SECTIONS 8{ 9 /* Read-only sections, merged into text segment: */ 10 PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x20000000)); . = SEGMENT_START("text-segment", 0x20000000) + SIZEOF_HEADERS; 11 .interp : { *(.interp) } 12 .reginfo : { *(.reginfo) } 13 .note.gnu.build-id : { *(.note.gnu.build-id) } 14 .dynamic : { *(.dynamic) } 15 .hash : { *(.hash) } 16 .gnu.hash : { *(.gnu.hash) } 17 .dynsym : { *(.dynsym) } 18 .dynstr : { *(.dynstr) } 19 .gnu.version : { *(.gnu.version) } 20 .gnu.version_d : { *(.gnu.version_d) } 21 .gnu.version_r : { *(.gnu.version_r) } 22 .rel.init : { *(.rel.init) } 23 .rela.init : { *(.rela.init) } 24 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 25 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 26 .rel.fini : { *(.rel.fini) } 27 .rela.fini : { *(.rela.fini) } 28 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 29 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 30 .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) } 31 .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) } 32 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 33 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 34 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 35 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 36 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 37 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 38 .rel.ctors : { *(.rel.ctors) } 39 .rela.ctors : { *(.rela.ctors) } 40 .rel.dtors : { *(.rel.dtors) } 41 .rela.dtors : { *(.rela.dtors) } 42 .rel.got : { *(.rel.got) } 43 .rela.got : { *(.rela.got) } 44 .rel.dyn : { *(.rel.dyn) } 45 .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } 46 .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } 47 .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } 48 .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } 49 .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } 50 .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } 51 .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } 52 .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } 53 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 54 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 55 .rel.iplt : 56 { 57 PROVIDE_HIDDEN (__rel_iplt_start = .); 58 *(.rel.iplt) 59 PROVIDE_HIDDEN (__rel_iplt_end = .); 60 } 61 .rela.iplt : 62 { 63 PROVIDE_HIDDEN (__rela_iplt_start = .); 64 *(.rela.iplt) 65 PROVIDE_HIDDEN (__rela_iplt_end = .); 66 } 67 .rel.plt : 68 { 69 *(.rel.plt) 70 } 71 .rela.plt : 72 { 73 *(.rela.plt) 74 } 75 .init : 76 { 77 KEEP (*(.init)) 78 } =0 79 .plt : { *(.plt) } 80 .iplt : { *(.iplt) } 81 .text : 82 { 83 _ftext = . ; 84 *(.text.unlikely .text.*_unlikely) 85 *(.text.exit .text.exit.*) 86 *(.text.startup .text.startup.*) 87 *(.text.hot .text.hot.*) 88 *(.text .stub .text.* .gnu.linkonce.t.*) 89 /* .gnu.warning sections are handled specially by elf32.em. */ 90 *(.gnu.warning) 91 *(.mips16.fn.*) *(.mips16.call.*) 92 } =0 93 .fini : 94 { 95 KEEP (*(.fini)) 96 } =0 97 PROVIDE (__etext = .); 98 PROVIDE (_etext = .); 99 PROVIDE (etext = .); 100 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 101 .rodata1 : { *(.rodata1) } 102 .sdata2 : 103 { 104 *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) 105 } 106 .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } 107 .eh_frame_hdr : { *(.eh_frame_hdr) } 108 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 109 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } 110 /* Adjust the address for the data segment. We want to adjust up to 111 the same address within the page on the next page up. */ 112 . = .; 113 /* Exception handling */ 114 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 115 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } 116 /* Thread Local Storage sections */ 117 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 118 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 119 .preinit_array : 120 { 121 PROVIDE_HIDDEN (__preinit_array_start = .); 122 KEEP (*(.preinit_array)) 123 PROVIDE_HIDDEN (__preinit_array_end = .); 124 } 125 .init_array : 126 { 127 PROVIDE_HIDDEN (__init_array_start = .); 128 KEEP (*(SORT(.init_array.*))) 129 KEEP (*(.init_array)) 130 PROVIDE_HIDDEN (__init_array_end = .); 131 } 132 .fini_array : 133 { 134 PROVIDE_HIDDEN (__fini_array_start = .); 135 KEEP (*(SORT(.fini_array.*))) 136 KEEP (*(.fini_array)) 137 PROVIDE_HIDDEN (__fini_array_end = .); 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* .gnu.linkonce.d.rel.ro.*) } 170 .data : 171 { 172 _fdata = . ; 173 *(.data .data.* .gnu.linkonce.d.*) 174 SORT(CONSTRUCTORS) 175 } 176 .data1 : { *(.data1) } 177 .got.plt : { *(.got.plt) } 178 . = .; 179 _gp = ALIGN(16) + 0x7ff0; 180 .got : { *(.got) } 181 /* We want the small data sections together, so single-instruction offsets 182 can access them all, and initialized data all before uninitialized, so 183 we can shorten the on-disk segment size. */ 184 .sdata : 185 { 186 *(.sdata .sdata.* .gnu.linkonce.s.*) 187 } 188 .lit8 : { *(.lit8) } 189 .lit4 : { *(.lit4) } 190 _edata = .; PROVIDE (edata = .); 191 __bss_start = .; 192 _fbss = .; 193 .sbss : 194 { 195 *(.dynsbss) 196 *(.sbss .sbss.* .gnu.linkonce.sb.*) 197 *(.scommon) 198 } 199 .bss : 200 { 201 *(.dynbss) 202 *(.bss .bss.* .gnu.linkonce.b.*) 203 *(COMMON) 204 /* Align here to ensure that the .bss section occupies space up to 205 _end. Align after .bss to ensure correct alignment even if the 206 .bss section disappears because there are no input sections. 207 FIXME: Why do we need it? When there is no .bss section, we don't 208 pad the .data section. */ 209 . = ALIGN(. != 0 ? 32 / 8 : 1); 210 } 211 . = ALIGN(32 / 8); 212 . = ALIGN(32 / 8); 213 _end = .; PROVIDE (end = .); 214 /* Stabs debugging sections. */ 215 .stab 0 : { *(.stab) } 216 .stabstr 0 : { *(.stabstr) } 217 .stab.excl 0 : { *(.stab.excl) } 218 .stab.exclstr 0 : { *(.stab.exclstr) } 219 .stab.index 0 : { *(.stab.index) } 220 .stab.indexstr 0 : { *(.stab.indexstr) } 221 .comment 0 : { *(.comment) } 222 /* DWARF debug sections. 223 Symbols in the DWARF debugging sections are relative to the beginning 224 of the section so we begin them at 0. */ 225 /* DWARF 1 */ 226 .debug 0 : { *(.debug) } 227 .line 0 : { *(.line) } 228 /* GNU DWARF 1 extensions */ 229 .debug_srcinfo 0 : { *(.debug_srcinfo) } 230 .debug_sfnames 0 : { *(.debug_sfnames) } 231 /* DWARF 1.1 and DWARF 2 */ 232 .debug_aranges 0 : { *(.debug_aranges) } 233 .debug_pubnames 0 : { *(.debug_pubnames) } 234 /* DWARF 2 */ 235 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 236 .debug_abbrev 0 : { *(.debug_abbrev) } 237 .debug_line 0 : { *(.debug_line) } 238 .debug_frame 0 : { *(.debug_frame) } 239 .debug_str 0 : { *(.debug_str) } 240 .debug_loc 0 : { *(.debug_loc) } 241 .debug_macinfo 0 : { *(.debug_macinfo) } 242 /* SGI/MIPS DWARF 2 extensions */ 243 .debug_weaknames 0 : { *(.debug_weaknames) } 244 .debug_funcnames 0 : { *(.debug_funcnames) } 245 .debug_typenames 0 : { *(.debug_typenames) } 246 .debug_varnames 0 : { *(.debug_varnames) } 247 /* DWARF 3 */ 248 .debug_pubtypes 0 : { *(.debug_pubtypes) } 249 .debug_ranges 0 : { *(.debug_ranges) } 250 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } 251 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } 252 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } 253 .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) } 254 .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) } 255 .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) } 256 .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) } 257 .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) } 258 .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) } 259 .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) } 260 .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) } 261 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } 262} 263