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