ldscript.mips.cfe revision 217652
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 217652 2011-01-20 19:16:29Z imp $ 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 41ENTRY(_start) 42SEARCH_DIR(/usr/lib); 43/* Do we need any of these for elf? 44 __DYNAMIC = 0; 45PROVIDE (_DYNAMIC = 0); 46*/ 47 48PHDRS 49{ 50 headers PT_PHDR FILEHDR PHDRS ; 51 interp PT_INTERP ; 52 text PT_LOAD ; 53 dynamic PT_LOAD ; 54 data PT_LOAD ; 55} 56 57SECTIONS 58{ 59 /* Read-only sections, merged into text segment: */ 60 . = KERNLOADADDR ; 61 .interp : { *(.interp) } :interp 62 .hash : { *(.hash) } :text 63 .dynsym : { *(.dynsym) } 64 .dynstr : { *(.dynstr) } 65 .gnu.version : { *(.gnu.version) } 66 .gnu.version_d : { *(.gnu.version_d) } 67 .gnu.version_r : { *(.gnu.version_r) } 68 .rel.init : { *(.rel.init) } 69 .rela.init : { *(.rela.init) } 70 .rel.text : 71 { 72 *(.rel.text) 73 *(.rel.text.*) 74 *(.rel.gnu.linkonce.t.*) 75 } 76 .rela.text : 77 { 78 *(.rela.text) 79 *(.rela.text.*) 80 *(.rela.gnu.linkonce.t.*) 81 } 82 .rel.fini : { *(.rel.fini) } 83 .rela.fini : { *(.rela.fini) } 84 .rel.rodata : 85 { 86 *(.rel.rodata) 87 *(.rel.rodata.*) 88 *(.rel.gnu.linkonce.r.*) 89 } 90 .rela.rodata : 91 { 92 *(.rela.rodata) 93 *(.rela.rodata.*) 94 *(.rela.gnu.linkonce.r.*) 95 } 96 .rel.data : 97 { 98 *(.rel.data) 99 *(.rel.data.*) 100 *(.rel.gnu.linkonce.d.*) 101 } 102 .rela.data : 103 { 104 *(.rela.data) 105 *(.rela.data.*) 106 *(.rela.gnu.linkonce.d.*) 107 } 108 .rel.ctors : { *(.rel.ctors) } 109 .rela.ctors : { *(.rela.ctors) } 110 .rel.dtors : { *(.rel.dtors) } 111 .rela.dtors : { *(.rela.dtors) } 112 .rel.got : { *(.rel.got) } 113 .rela.got : { *(.rela.got) } 114 .rel.sdata : 115 { 116 *(.rel.sdata) 117 *(.rel.sdata.*) 118 *(.rel.gnu.linkonce.s.*) 119 } 120 .rela.sdata : 121 { 122 *(.rela.sdata) 123 *(.rela.sdata.*) 124 *(.rela.gnu.linkonce.s.*) 125 } 126 .rel.sbss : 127 { 128 *(.rel.sbss) 129 *(.rel.sbss.*) 130 *(.rel.gnu.linkonce.sb.*) 131 } 132 .rela.sbss : 133 { 134 *(.rela.sbss) 135 *(.rela.sbss.*) 136 *(.rel.gnu.linkonce.sb.*) 137 } 138 .rel.sdata2 : 139 { 140 *(.rel.sdata2) 141 *(.rel.sdata2.*) 142 *(.rel.gnu.linkonce.s2.*) 143 } 144 .rela.sdata2 : 145 { 146 *(.rela.sdata2) 147 *(.rela.sdata2.*) 148 *(.rela.gnu.linkonce.s2.*) 149 } 150 .rel.sbss2 : 151 { 152 *(.rel.sbss2) 153 *(.rel.sbss2.*) 154 *(.rel.gnu.linkonce.sb2.*) 155 } 156 .rela.sbss2 : 157 { 158 *(.rela.sbss2) 159 *(.rela.sbss2.*) 160 *(.rela.gnu.linkonce.sb2.*) 161 } 162 .rel.bss : 163 { 164 *(.rel.bss) 165 *(.rel.bss.*) 166 *(.rel.gnu.linkonce.b.*) 167 } 168 .rela.bss : 169 { 170 *(.rela.bss) 171 *(.rela.bss.*) 172 *(.rela.gnu.linkonce.b.*) 173 } 174 .rel.plt : { *(.rel.plt) } 175 .rela.plt : { *(.rela.plt) } 176 .init : 177 { 178 KEEP (*(.init)) 179 } :text =0x1000000 180 .text : 181 { 182 *(.trap) 183 *(.text) 184 *(.text.*) 185 *(.stub) 186 /* .gnu.warning sections are handled specially by elf32.em. */ 187 *(.gnu.warning) 188 *(.gnu.linkonce.t.*) 189 } =0x1000000 190 .fini : 191 { 192 KEEP (*(.fini)) 193 } =0x1000000 194 PROVIDE (__etext = .); 195 PROVIDE (_etext = .); 196 PROVIDE (etext = .); 197 .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } 198 .rodata1 : { *(.rodata1) } 199 .reginfo : { *(.reginfo) } 200 .sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) } 201 .sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) } 202 . = ALIGN(0x2000) + (. & (0x2000 - 1)); 203 .data : 204 { 205 *(.data) 206 *(.data.*) 207 *(.gnu.linkonce.d.*) 208 SORT(CONSTRUCTORS) 209 } :data 210 .data1 : { *(.data1) } 211 .eh_frame : { KEEP (*(.eh_frame)) } 212 .gcc_except_table : { *(.gcc_except_table) } 213 .ctors : 214 { 215 /* gcc uses crtbegin.o to find the start of 216 the constructors, so we make sure it is 217 first. Because this is a wildcard, it 218 doesn't matter if the user does not 219 actually link against crtbegin.o; the 220 linker won't look for a file to match a 221 wildcard. The wildcard also means that it 222 doesn't matter which directory crtbegin.o 223 is in. */ 224 KEEP (*crtbegin.o(.ctors)) 225 /* We don't want to include the .ctor section from 226 from the crtend.o file until after the sorted ctors. 227 The .ctor section from the crtend file contains the 228 end of ctors marker and it must be last */ 229 KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) 230 KEEP (*(SORT(.ctors.*))) 231 KEEP (*(.ctors)) 232 } 233 .dtors : 234 { 235 KEEP (*crtbegin.o(.dtors)) 236 KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) 237 KEEP (*(SORT(.dtors.*))) 238 KEEP (*(.dtors)) 239 } 240 .plt : { *(.plt) } 241 _gp = ALIGN(16) + 0x7ff0; 242 .got : { *(.got.plt) *(.got) } 243 .dynamic : { *(.dynamic) } :dynamic 244 /* We want the small data sections together, so single-instruction offsets 245 can access them all, and initialized data all before uninitialized, so 246 we can shorten the on-disk segment size. */ 247 .sdata : 248 { 249 *(.sdata) 250 *(.sdata.*) 251 *(.gnu.linkonce.s.*) 252 } 253 _edata = .; 254 PROVIDE (edata = .); 255 __bss_start = .; 256 .sbss : 257 { 258 PROVIDE (__sbss_start = .); 259 PROVIDE (___sbss_start = .); 260 *(.dynsbss) 261 *(.sbss) 262 *(.sbss.*) 263 *(.gnu.linkonce.sb.*) 264 *(.scommon) 265 PROVIDE (__sbss_end = .); 266 PROVIDE (___sbss_end = .); 267 } 268 .bss : 269 { 270 *(.dynbss) 271 *(.bss) 272 *(.bss.*) 273 *(.gnu.linkonce.b.*) 274 *(COMMON) 275 /* Align here to ensure that the .bss section occupies space up to 276 _end. Align after .bss to ensure correct alignment even if the 277 .bss section disappears because there are no input sections. */ 278 . = ALIGN(64 / 8); 279 } 280 . = ALIGN(64 / 8); 281 _end = .; 282 PROVIDE (end = .); 283 /* Stabs debugging sections. */ 284 .stab 0 : { *(.stab) } 285 .stabstr 0 : { *(.stabstr) } 286 .stab.excl 0 : { *(.stab.excl) } 287 .stab.exclstr 0 : { *(.stab.exclstr) } 288 .stab.index 0 : { *(.stab.index) } 289 .stab.indexstr 0 : { *(.stab.indexstr) } 290 .comment 0 : { *(.comment) } 291 /* DWARF debug sections. 292 Symbols in the DWARF debugging sections are relative to the beginning 293 of the section so we begin them at 0. */ 294 /* DWARF 1 */ 295 .debug 0 : { *(.debug) } 296 .line 0 : { *(.line) } 297 /* GNU DWARF 1 extensions */ 298 .debug_srcinfo 0 : { *(.debug_srcinfo) } 299 .debug_sfnames 0 : { *(.debug_sfnames) } 300 /* DWARF 1.1 and DWARF 2 */ 301 .debug_aranges 0 : { *(.debug_aranges) } 302 .debug_pubnames 0 : { *(.debug_pubnames) } 303 /* DWARF 2 */ 304 .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } 305 .debug_abbrev 0 : { *(.debug_abbrev) } 306 .debug_line 0 : { *(.debug_line) } 307 .debug_frame 0 : { *(.debug_frame) } 308 .debug_str 0 : { *(.debug_str) } 309 .debug_loc 0 : { *(.debug_loc) } 310 .debug_macinfo 0 : { *(.debug_macinfo) } 311 /* SGI/MIPS DWARF 2 extensions */ 312 .debug_weaknames 0 : { *(.debug_weaknames) } 313 .debug_funcnames 0 : { *(.debug_funcnames) } 314 .debug_typenames 0 : { *(.debug_typenames) } 315 .debug_varnames 0 : { *(.debug_varnames) } 316 /* These must appear regardless of . */ 317} 318