ldscript.mips.cfe revision 183815
1/*- 2 * Copyright (c) 2001, 2004, 2008, Juniper Networks, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the Juniper Networks, Inc. nor the names of its 14 * contributors may be used to endorse or promote products derived from 15 * this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY JUNIPER NETWORKS AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL JUNIPER NETWORKS OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * JNPR: ldscript.mips,v 1.3 2006/10/11 06:12:04 30 * $FreeBSD: head/sys/conf/ldscript.mips.cfe 183815 2008-10-13 06:07:58Z bms $ 31 */ 32 33/* 34 * This linker script is needed to build a kernel for use by Broadcom CFE 35 * when loaded over TFTP; its ELF loader does not support backwards seek 36 * on network I/O streams. 37 * Furthermore, CFE will only load PT_LOAD segments, therefore the dynamic 38 * sections must be placed in their own segment. 39 */ 40 41OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", 42 "elf32-tradlittlemips") 43 44OUTPUT_ARCH(mips) 45ENTRY(_start) 46SEARCH_DIR(/usr/lib); 47/* Do we need any of these for elf? 48 __DYNAMIC = 0; 49PROVIDE (_DYNAMIC = 0); 50*/ 51 52PHDRS 53{ 54 headers PT_PHDR FILEHDR PHDRS ; 55 interp PT_INTERP ; 56 text PT_LOAD ; 57 dynamic PT_LOAD ; 58 data PT_LOAD ; 59} 60 61SECTIONS 62{ 63 /* Read-only sections, merged into text segment: */ 64 . = 0x80100000 ; 65 .interp : { *(.interp) } :interp 66 .hash : { *(.hash) } :text 67 .dynsym : { *(.dynsym) } 68 .dynstr : { *(.dynstr) } 69 .gnu.version : { *(.gnu.version) } 70 .gnu.version_d : { *(.gnu.version_d) } 71 .gnu.version_r : { *(.gnu.version_r) } 72 .rel.init : { *(.rel.init) } 73 .rela.init : { *(.rela.init) } 74 .rel.text : 75 { 76 *(.rel.text) 77 *(.rel.text.*) 78 *(.rel.gnu.linkonce.t.*) 79 } 80 .rela.text : 81 { 82 *(.rela.text) 83 *(.rela.text.*) 84 *(.rela.gnu.linkonce.t.*) 85 } 86 .rel.fini : { *(.rel.fini) } 87 .rela.fini : { *(.rela.fini) } 88 .rel.rodata : 89 { 90 *(.rel.rodata) 91 *(.rel.rodata.*) 92 *(.rel.gnu.linkonce.r.*) 93 } 94 .rela.rodata : 95 { 96 *(.rela.rodata) 97 *(.rela.rodata.*) 98 *(.rela.gnu.linkonce.r.*) 99 } 100 .rel.data : 101 { 102 *(.rel.data) 103 *(.rel.data.*) 104 *(.rel.gnu.linkonce.d.*) 105 } 106 .rela.data : 107 { 108 *(.rela.data) 109 *(.rela.data.*) 110 *(.rela.gnu.linkonce.d.*) 111 } 112 .rel.ctors : { *(.rel.ctors) } 113 .rela.ctors : { *(.rela.ctors) } 114 .rel.dtors : { *(.rel.dtors) } 115 .rela.dtors : { *(.rela.dtors) } 116 .rel.got : { *(.rel.got) } 117 .rela.got : { *(.rela.got) } 118 .rel.sdata : 119 { 120 *(.rel.sdata) 121 *(.rel.sdata.*) 122 *(.rel.gnu.linkonce.s.*) 123 } 124 .rela.sdata : 125 { 126 *(.rela.sdata) 127 *(.rela.sdata.*) 128 *(.rela.gnu.linkonce.s.*) 129 } 130 .rel.sbss : 131 { 132 *(.rel.sbss) 133 *(.rel.sbss.*) 134 *(.rel.gnu.linkonce.sb.*) 135 } 136 .rela.sbss : 137 { 138 *(.rela.sbss) 139 *(.rela.sbss.*) 140 *(.rel.gnu.linkonce.sb.*) 141 } 142 .rel.sdata2 : 143 { 144 *(.rel.sdata2) 145 *(.rel.sdata2.*) 146 *(.rel.gnu.linkonce.s2.*) 147 } 148 .rela.sdata2 : 149 { 150 *(.rela.sdata2) 151 *(.rela.sdata2.*) 152 *(.rela.gnu.linkonce.s2.*) 153 } 154 .rel.sbss2 : 155 { 156 *(.rel.sbss2) 157 *(.rel.sbss2.*) 158 *(.rel.gnu.linkonce.sb2.*) 159 } 160 .rela.sbss2 : 161 { 162 *(.rela.sbss2) 163 *(.rela.sbss2.*) 164 *(.rela.gnu.linkonce.sb2.*) 165 } 166 .rel.bss : 167 { 168 *(.rel.bss) 169 *(.rel.bss.*) 170 *(.rel.gnu.linkonce.b.*) 171 } 172 .rela.bss : 173 { 174 *(.rela.bss) 175 *(.rela.bss.*) 176 *(.rela.gnu.linkonce.b.*) 177 } 178 .rel.plt : { *(.rel.plt) } 179 .rela.plt : { *(.rela.plt) } 180 .init : 181 { 182 KEEP (*(.init)) 183 } :text =0x1000000 184 .text : 185 { 186 *(.trap) 187 *(.text) 188 *(.text.*) 189 *(.stub) 190 /* .gnu.warning sections are handled specially by elf32.em. */ 191 *(.gnu.warning) 192 *(.gnu.linkonce.t.*) 193 } =0x1000000 194 .fini : 195 { 196 KEEP (*(.fini)) 197 } =0x1000000 198 PROVIDE (__etext = .); 199 PROVIDE (_etext = .); 200 PROVIDE (etext = .); 201 .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } 202 .rodata1 : { *(.rodata1) } 203 .reginfo : { *(.reginfo) } 204 .sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) } 205 .sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) } 206 . = ALIGN(0x2000) + (. & (0x2000 - 1)); 207 .data : 208 { 209 *(.data) 210 *(.data.*) 211 *(.gnu.linkonce.d.*) 212 SORT(CONSTRUCTORS) 213 } :data 214 .data1 : { *(.data1) } 215 .eh_frame : { KEEP (*(.eh_frame)) } 216 .gcc_except_table : { *(.gcc_except_table) } 217 .ctors : 218 { 219 /* gcc uses crtbegin.o to find the start of 220 the constructors, so we make sure it is 221 first. Because this is a wildcard, it 222 doesn't matter if the user does not 223 actually link against crtbegin.o; the 224 linker won't look for a file to match a 225 wildcard. The wildcard also means that it 226 doesn't matter which directory crtbegin.o 227 is in. */ 228 KEEP (*crtbegin.o(.ctors)) 229 /* We don't want to include the .ctor section from 230 from the crtend.o file until after the sorted ctors. 231 The .ctor section from the crtend file contains the 232 end of ctors marker and it must be last */ 233 KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) 234 KEEP (*(SORT(.ctors.*))) 235 KEEP (*(.ctors)) 236 } 237 .dtors : 238 { 239 KEEP (*crtbegin.o(.dtors)) 240 KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) 241 KEEP (*(SORT(.dtors.*))) 242 KEEP (*(.dtors)) 243 } 244 .plt : { *(.plt) } 245 _gp = ALIGN(16) + 0x7ff0; 246 .got : { *(.got.plt) *(.got) } 247 .dynamic : { *(.dynamic) } :dynamic 248 /* We want the small data sections together, so single-instruction offsets 249 can access them all, and initialized data all before uninitialized, so 250 we can shorten the on-disk segment size. */ 251 .sdata : 252 { 253 *(.sdata) 254 *(.sdata.*) 255 *(.gnu.linkonce.s.*) 256 } 257 _edata = .; 258 PROVIDE (edata = .); 259 __bss_start = .; 260 .sbss : 261 { 262 PROVIDE (__sbss_start = .); 263 PROVIDE (___sbss_start = .); 264 *(.dynsbss) 265 *(.sbss) 266 *(.sbss.*) 267 *(.gnu.linkonce.sb.*) 268 *(.scommon) 269 PROVIDE (__sbss_end = .); 270 PROVIDE (___sbss_end = .); 271 } 272 .bss : 273 { 274 *(.dynbss) 275 *(.bss) 276 *(.bss.*) 277 *(.gnu.linkonce.b.*) 278 *(COMMON) 279 /* Align here to ensure that the .bss section occupies space up to 280 _end. Align after .bss to ensure correct alignment even if the 281 .bss section disappears because there are no input sections. */ 282 . = ALIGN(64 / 8); 283 } 284 . = ALIGN(64 / 8); 285 _end = .; 286 PROVIDE (end = .); 287 /* Stabs debugging sections. */ 288 .stab 0 : { *(.stab) } 289 .stabstr 0 : { *(.stabstr) } 290 .stab.excl 0 : { *(.stab.excl) } 291 .stab.exclstr 0 : { *(.stab.exclstr) } 292 .stab.index 0 : { *(.stab.index) } 293 .stab.indexstr 0 : { *(.stab.indexstr) } 294 .comment 0 : { *(.comment) } 295 /* DWARF debug sections. 296 Symbols in the DWARF debugging sections are relative to the beginning 297 of the section so we begin them at 0. */ 298 /* DWARF 1 */ 299 .debug 0 : { *(.debug) } 300 .line 0 : { *(.line) } 301 /* GNU DWARF 1 extensions */ 302 .debug_srcinfo 0 : { *(.debug_srcinfo) } 303 .debug_sfnames 0 : { *(.debug_sfnames) } 304 /* DWARF 1.1 and DWARF 2 */ 305 .debug_aranges 0 : { *(.debug_aranges) } 306 .debug_pubnames 0 : { *(.debug_pubnames) } 307 /* DWARF 2 */ 308 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } 309 .debug_abbrev 0 : { *(.debug_abbrev) } 310 .debug_line 0 : { *(.debug_line) } 311 .debug_frame 0 : { *(.debug_frame) } 312 .debug_str 0 : { *(.debug_str) } 313 .debug_loc 0 : { *(.debug_loc) } 314 .debug_macinfo 0 : { *(.debug_macinfo) } 315 /* SGI/MIPS DWARF 2 extensions */ 316 .debug_weaknames 0 : { *(.debug_weaknames) } 317 .debug_funcnames 0 : { *(.debug_funcnames) } 318 .debug_typenames 0 : { *(.debug_typenames) } 319 .debug_varnames 0 : { *(.debug_varnames) } 320 /* These must appear regardless of . */ 321} 322