1183815Sbms/*- 2183815Sbms * Copyright (c) 2001, 2004, 2008, Juniper Networks, Inc. 3183815Sbms * All rights reserved. 4183815Sbms * 5183815Sbms * Redistribution and use in source and binary forms, with or without 6183815Sbms * modification, are permitted provided that the following conditions 7183815Sbms * are met: 8183815Sbms * 1. Redistributions of source code must retain the above copyright 9183815Sbms * notice, this list of conditions and the following disclaimer. 10183815Sbms * 2. Redistributions in binary form must reproduce the above copyright 11183815Sbms * notice, this list of conditions and the following disclaimer in the 12183815Sbms * documentation and/or other materials provided with the distribution. 13183815Sbms * 3. Neither the name of the Juniper Networks, Inc. nor the names of its 14183815Sbms * contributors may be used to endorse or promote products derived from 15183815Sbms * this software without specific prior written permission. 16183815Sbms * 17183815Sbms * THIS SOFTWARE IS PROVIDED BY JUNIPER NETWORKS AND CONTRIBUTORS ``AS IS'' AND 18183815Sbms * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19183815Sbms * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20183815Sbms * ARE DISCLAIMED. IN NO EVENT SHALL JUNIPER NETWORKS OR CONTRIBUTORS BE LIABLE 21183815Sbms * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22183815Sbms * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23183815Sbms * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24183815Sbms * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25183815Sbms * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26183815Sbms * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27183815Sbms * SUCH DAMAGE. 28183815Sbms * 29183815Sbms * JNPR: ldscript.mips,v 1.3 2006/10/11 06:12:04 30183815Sbms * $FreeBSD: releng/10.2/sys/conf/ldscript.mips.cfe 217655 2011-01-20 19:20:23Z imp $ 31183815Sbms */ 32183815Sbms 33178170Simp/* 34183815Sbms * This linker script is needed to build a kernel for use by Broadcom CFE 35183815Sbms * when loaded over TFTP; its ELF loader does not support backwards seek 36183815Sbms * on network I/O streams. 37183815Sbms * Furthermore, CFE will only load PT_LOAD segments, therefore the dynamic 38183815Sbms * sections must be placed in their own segment. 39178170Simp */ 40178170Simp 41178170SimpENTRY(_start) 42178170SimpSEARCH_DIR(/usr/lib); 43183815Sbms 44183815SbmsPHDRS 45183815Sbms{ 46183815Sbms headers PT_PHDR FILEHDR PHDRS ; 47183815Sbms interp PT_INTERP ; 48183815Sbms text PT_LOAD ; 49183815Sbms dynamic PT_LOAD ; 50183815Sbms data PT_LOAD ; 51183815Sbms} 52183815Sbms 53178170SimpSECTIONS 54178170Simp{ 55178170Simp /* Read-only sections, merged into text segment: */ 56204186Sneel . = KERNLOADADDR ; 57183815Sbms .interp : { *(.interp) } :interp 58183815Sbms .hash : { *(.hash) } :text 59178170Simp .dynsym : { *(.dynsym) } 60178170Simp .dynstr : { *(.dynstr) } 61178170Simp .gnu.version : { *(.gnu.version) } 62178170Simp .gnu.version_d : { *(.gnu.version_d) } 63178170Simp .gnu.version_r : { *(.gnu.version_r) } 64178170Simp .rel.init : { *(.rel.init) } 65178170Simp .rela.init : { *(.rela.init) } 66178170Simp .rel.text : 67178170Simp { 68178170Simp *(.rel.text) 69178170Simp *(.rel.text.*) 70178170Simp *(.rel.gnu.linkonce.t.*) 71178170Simp } 72178170Simp .rela.text : 73178170Simp { 74178170Simp *(.rela.text) 75178170Simp *(.rela.text.*) 76178170Simp *(.rela.gnu.linkonce.t.*) 77178170Simp } 78178170Simp .rel.fini : { *(.rel.fini) } 79178170Simp .rela.fini : { *(.rela.fini) } 80178170Simp .rel.rodata : 81178170Simp { 82178170Simp *(.rel.rodata) 83178170Simp *(.rel.rodata.*) 84178170Simp *(.rel.gnu.linkonce.r.*) 85178170Simp } 86178170Simp .rela.rodata : 87178170Simp { 88178170Simp *(.rela.rodata) 89178170Simp *(.rela.rodata.*) 90178170Simp *(.rela.gnu.linkonce.r.*) 91178170Simp } 92178170Simp .rel.data : 93178170Simp { 94178170Simp *(.rel.data) 95178170Simp *(.rel.data.*) 96178170Simp *(.rel.gnu.linkonce.d.*) 97178170Simp } 98178170Simp .rela.data : 99178170Simp { 100178170Simp *(.rela.data) 101178170Simp *(.rela.data.*) 102178170Simp *(.rela.gnu.linkonce.d.*) 103178170Simp } 104178170Simp .rel.ctors : { *(.rel.ctors) } 105178170Simp .rela.ctors : { *(.rela.ctors) } 106178170Simp .rel.dtors : { *(.rel.dtors) } 107178170Simp .rela.dtors : { *(.rela.dtors) } 108178170Simp .rel.got : { *(.rel.got) } 109178170Simp .rela.got : { *(.rela.got) } 110178170Simp .rel.sdata : 111178170Simp { 112178170Simp *(.rel.sdata) 113178170Simp *(.rel.sdata.*) 114178170Simp *(.rel.gnu.linkonce.s.*) 115178170Simp } 116178170Simp .rela.sdata : 117178170Simp { 118178170Simp *(.rela.sdata) 119178170Simp *(.rela.sdata.*) 120178170Simp *(.rela.gnu.linkonce.s.*) 121178170Simp } 122178170Simp .rel.sbss : 123178170Simp { 124178170Simp *(.rel.sbss) 125178170Simp *(.rel.sbss.*) 126178170Simp *(.rel.gnu.linkonce.sb.*) 127178170Simp } 128178170Simp .rela.sbss : 129178170Simp { 130178170Simp *(.rela.sbss) 131178170Simp *(.rela.sbss.*) 132178170Simp *(.rel.gnu.linkonce.sb.*) 133178170Simp } 134178170Simp .rel.sdata2 : 135178170Simp { 136178170Simp *(.rel.sdata2) 137178170Simp *(.rel.sdata2.*) 138178170Simp *(.rel.gnu.linkonce.s2.*) 139178170Simp } 140178170Simp .rela.sdata2 : 141178170Simp { 142178170Simp *(.rela.sdata2) 143178170Simp *(.rela.sdata2.*) 144178170Simp *(.rela.gnu.linkonce.s2.*) 145178170Simp } 146178170Simp .rel.sbss2 : 147178170Simp { 148178170Simp *(.rel.sbss2) 149178170Simp *(.rel.sbss2.*) 150178170Simp *(.rel.gnu.linkonce.sb2.*) 151178170Simp } 152178170Simp .rela.sbss2 : 153178170Simp { 154178170Simp *(.rela.sbss2) 155178170Simp *(.rela.sbss2.*) 156178170Simp *(.rela.gnu.linkonce.sb2.*) 157178170Simp } 158178170Simp .rel.bss : 159178170Simp { 160178170Simp *(.rel.bss) 161178170Simp *(.rel.bss.*) 162178170Simp *(.rel.gnu.linkonce.b.*) 163178170Simp } 164178170Simp .rela.bss : 165178170Simp { 166178170Simp *(.rela.bss) 167178170Simp *(.rela.bss.*) 168178170Simp *(.rela.gnu.linkonce.b.*) 169178170Simp } 170178170Simp .rel.plt : { *(.rel.plt) } 171178170Simp .rela.plt : { *(.rela.plt) } 172178170Simp .init : 173178170Simp { 174178170Simp KEEP (*(.init)) 175183815Sbms } :text =0x1000000 176183815Sbms .text : 177183815Sbms { 178183815Sbms *(.trap) 179183815Sbms *(.text) 180183815Sbms *(.text.*) 181183815Sbms *(.stub) 182183815Sbms /* .gnu.warning sections are handled specially by elf32.em. */ 183183815Sbms *(.gnu.warning) 184183815Sbms *(.gnu.linkonce.t.*) 185183815Sbms } =0x1000000 186178170Simp .fini : 187178170Simp { 188178170Simp KEEP (*(.fini)) 189178170Simp } =0x1000000 190178170Simp PROVIDE (__etext = .); 191178170Simp PROVIDE (_etext = .); 192178170Simp PROVIDE (etext = .); 193178170Simp .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } 194178170Simp .rodata1 : { *(.rodata1) } 195178170Simp .reginfo : { *(.reginfo) } 196178170Simp .sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) } 197178170Simp .sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) } 198178170Simp . = ALIGN(0x2000) + (. & (0x2000 - 1)); 199178170Simp .data : 200178170Simp { 201178170Simp *(.data) 202178170Simp *(.data.*) 203178170Simp *(.gnu.linkonce.d.*) 204178170Simp SORT(CONSTRUCTORS) 205183815Sbms } :data 206178170Simp .data1 : { *(.data1) } 207178170Simp .eh_frame : { KEEP (*(.eh_frame)) } 208178170Simp .gcc_except_table : { *(.gcc_except_table) } 209178170Simp .ctors : 210178170Simp { 211178170Simp /* gcc uses crtbegin.o to find the start of 212178170Simp the constructors, so we make sure it is 213178170Simp first. Because this is a wildcard, it 214178170Simp doesn't matter if the user does not 215178170Simp actually link against crtbegin.o; the 216178170Simp linker won't look for a file to match a 217178170Simp wildcard. The wildcard also means that it 218178170Simp doesn't matter which directory crtbegin.o 219178170Simp is in. */ 220178170Simp KEEP (*crtbegin.o(.ctors)) 221178170Simp /* We don't want to include the .ctor section from 222178170Simp from the crtend.o file until after the sorted ctors. 223178170Simp The .ctor section from the crtend file contains the 224178170Simp end of ctors marker and it must be last */ 225178170Simp KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) 226178170Simp KEEP (*(SORT(.ctors.*))) 227178170Simp KEEP (*(.ctors)) 228178170Simp } 229178170Simp .dtors : 230178170Simp { 231178170Simp KEEP (*crtbegin.o(.dtors)) 232178170Simp KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) 233178170Simp KEEP (*(SORT(.dtors.*))) 234178170Simp KEEP (*(.dtors)) 235178170Simp } 236178170Simp .plt : { *(.plt) } 237178170Simp _gp = ALIGN(16) + 0x7ff0; 238178170Simp .got : { *(.got.plt) *(.got) } 239183815Sbms .dynamic : { *(.dynamic) } :dynamic 240178170Simp /* We want the small data sections together, so single-instruction offsets 241178170Simp can access them all, and initialized data all before uninitialized, so 242178170Simp we can shorten the on-disk segment size. */ 243178170Simp .sdata : 244178170Simp { 245178170Simp *(.sdata) 246178170Simp *(.sdata.*) 247178170Simp *(.gnu.linkonce.s.*) 248178170Simp } 249178170Simp _edata = .; 250178170Simp PROVIDE (edata = .); 251178170Simp __bss_start = .; 252178170Simp .sbss : 253178170Simp { 254178170Simp PROVIDE (__sbss_start = .); 255178170Simp PROVIDE (___sbss_start = .); 256178170Simp *(.dynsbss) 257178170Simp *(.sbss) 258178170Simp *(.sbss.*) 259178170Simp *(.gnu.linkonce.sb.*) 260178170Simp *(.scommon) 261178170Simp PROVIDE (__sbss_end = .); 262178170Simp PROVIDE (___sbss_end = .); 263178170Simp } 264178170Simp .bss : 265178170Simp { 266178170Simp *(.dynbss) 267178170Simp *(.bss) 268178170Simp *(.bss.*) 269178170Simp *(.gnu.linkonce.b.*) 270178170Simp *(COMMON) 271178170Simp /* Align here to ensure that the .bss section occupies space up to 272178170Simp _end. Align after .bss to ensure correct alignment even if the 273178170Simp .bss section disappears because there are no input sections. */ 274178170Simp . = ALIGN(64 / 8); 275178170Simp } 276178170Simp . = ALIGN(64 / 8); 277178170Simp _end = .; 278178170Simp PROVIDE (end = .); 279178170Simp /* Stabs debugging sections. */ 280178170Simp .stab 0 : { *(.stab) } 281178170Simp .stabstr 0 : { *(.stabstr) } 282178170Simp .stab.excl 0 : { *(.stab.excl) } 283178170Simp .stab.exclstr 0 : { *(.stab.exclstr) } 284178170Simp .stab.index 0 : { *(.stab.index) } 285178170Simp .stab.indexstr 0 : { *(.stab.indexstr) } 286178170Simp .comment 0 : { *(.comment) } 287178170Simp /* DWARF debug sections. 288178170Simp Symbols in the DWARF debugging sections are relative to the beginning 289178170Simp of the section so we begin them at 0. */ 290178170Simp /* DWARF 1 */ 291178170Simp .debug 0 : { *(.debug) } 292178170Simp .line 0 : { *(.line) } 293178170Simp /* GNU DWARF 1 extensions */ 294178170Simp .debug_srcinfo 0 : { *(.debug_srcinfo) } 295178170Simp .debug_sfnames 0 : { *(.debug_sfnames) } 296178170Simp /* DWARF 1.1 and DWARF 2 */ 297178170Simp .debug_aranges 0 : { *(.debug_aranges) } 298178170Simp .debug_pubnames 0 : { *(.debug_pubnames) } 299178170Simp /* DWARF 2 */ 300178170Simp .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } 301178170Simp .debug_abbrev 0 : { *(.debug_abbrev) } 302178170Simp .debug_line 0 : { *(.debug_line) } 303178170Simp .debug_frame 0 : { *(.debug_frame) } 304178170Simp .debug_str 0 : { *(.debug_str) } 305178170Simp .debug_loc 0 : { *(.debug_loc) } 306178170Simp .debug_macinfo 0 : { *(.debug_macinfo) } 307178170Simp /* SGI/MIPS DWARF 2 extensions */ 308178170Simp .debug_weaknames 0 : { *(.debug_weaknames) } 309178170Simp .debug_funcnames 0 : { *(.debug_funcnames) } 310178170Simp .debug_typenames 0 : { *(.debug_typenames) } 311178170Simp .debug_varnames 0 : { *(.debug_varnames) } 312178170Simp /* These must appear regardless of . */ 313178170Simp} 314