ldscript.mips.cfe revision 183815
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: head/sys/conf/ldscript.mips.cfe 183815 2008-10-13 06:07:58Z bms $ 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 41183815SbmsOUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", 42183815Sbms "elf32-tradlittlemips") 43183815Sbms 44178170SimpOUTPUT_ARCH(mips) 45178170SimpENTRY(_start) 46178170SimpSEARCH_DIR(/usr/lib); 47178170Simp/* Do we need any of these for elf? 48178170Simp __DYNAMIC = 0; 49178170SimpPROVIDE (_DYNAMIC = 0); 50178170Simp*/ 51183815Sbms 52183815SbmsPHDRS 53183815Sbms{ 54183815Sbms headers PT_PHDR FILEHDR PHDRS ; 55183815Sbms interp PT_INTERP ; 56183815Sbms text PT_LOAD ; 57183815Sbms dynamic PT_LOAD ; 58183815Sbms data PT_LOAD ; 59183815Sbms} 60183815Sbms 61178170SimpSECTIONS 62178170Simp{ 63178170Simp /* Read-only sections, merged into text segment: */ 64183815Sbms . = 0x80100000 ; 65183815Sbms .interp : { *(.interp) } :interp 66183815Sbms .hash : { *(.hash) } :text 67178170Simp .dynsym : { *(.dynsym) } 68178170Simp .dynstr : { *(.dynstr) } 69178170Simp .gnu.version : { *(.gnu.version) } 70178170Simp .gnu.version_d : { *(.gnu.version_d) } 71178170Simp .gnu.version_r : { *(.gnu.version_r) } 72178170Simp .rel.init : { *(.rel.init) } 73178170Simp .rela.init : { *(.rela.init) } 74178170Simp .rel.text : 75178170Simp { 76178170Simp *(.rel.text) 77178170Simp *(.rel.text.*) 78178170Simp *(.rel.gnu.linkonce.t.*) 79178170Simp } 80178170Simp .rela.text : 81178170Simp { 82178170Simp *(.rela.text) 83178170Simp *(.rela.text.*) 84178170Simp *(.rela.gnu.linkonce.t.*) 85178170Simp } 86178170Simp .rel.fini : { *(.rel.fini) } 87178170Simp .rela.fini : { *(.rela.fini) } 88178170Simp .rel.rodata : 89178170Simp { 90178170Simp *(.rel.rodata) 91178170Simp *(.rel.rodata.*) 92178170Simp *(.rel.gnu.linkonce.r.*) 93178170Simp } 94178170Simp .rela.rodata : 95178170Simp { 96178170Simp *(.rela.rodata) 97178170Simp *(.rela.rodata.*) 98178170Simp *(.rela.gnu.linkonce.r.*) 99178170Simp } 100178170Simp .rel.data : 101178170Simp { 102178170Simp *(.rel.data) 103178170Simp *(.rel.data.*) 104178170Simp *(.rel.gnu.linkonce.d.*) 105178170Simp } 106178170Simp .rela.data : 107178170Simp { 108178170Simp *(.rela.data) 109178170Simp *(.rela.data.*) 110178170Simp *(.rela.gnu.linkonce.d.*) 111178170Simp } 112178170Simp .rel.ctors : { *(.rel.ctors) } 113178170Simp .rela.ctors : { *(.rela.ctors) } 114178170Simp .rel.dtors : { *(.rel.dtors) } 115178170Simp .rela.dtors : { *(.rela.dtors) } 116178170Simp .rel.got : { *(.rel.got) } 117178170Simp .rela.got : { *(.rela.got) } 118178170Simp .rel.sdata : 119178170Simp { 120178170Simp *(.rel.sdata) 121178170Simp *(.rel.sdata.*) 122178170Simp *(.rel.gnu.linkonce.s.*) 123178170Simp } 124178170Simp .rela.sdata : 125178170Simp { 126178170Simp *(.rela.sdata) 127178170Simp *(.rela.sdata.*) 128178170Simp *(.rela.gnu.linkonce.s.*) 129178170Simp } 130178170Simp .rel.sbss : 131178170Simp { 132178170Simp *(.rel.sbss) 133178170Simp *(.rel.sbss.*) 134178170Simp *(.rel.gnu.linkonce.sb.*) 135178170Simp } 136178170Simp .rela.sbss : 137178170Simp { 138178170Simp *(.rela.sbss) 139178170Simp *(.rela.sbss.*) 140178170Simp *(.rel.gnu.linkonce.sb.*) 141178170Simp } 142178170Simp .rel.sdata2 : 143178170Simp { 144178170Simp *(.rel.sdata2) 145178170Simp *(.rel.sdata2.*) 146178170Simp *(.rel.gnu.linkonce.s2.*) 147178170Simp } 148178170Simp .rela.sdata2 : 149178170Simp { 150178170Simp *(.rela.sdata2) 151178170Simp *(.rela.sdata2.*) 152178170Simp *(.rela.gnu.linkonce.s2.*) 153178170Simp } 154178170Simp .rel.sbss2 : 155178170Simp { 156178170Simp *(.rel.sbss2) 157178170Simp *(.rel.sbss2.*) 158178170Simp *(.rel.gnu.linkonce.sb2.*) 159178170Simp } 160178170Simp .rela.sbss2 : 161178170Simp { 162178170Simp *(.rela.sbss2) 163178170Simp *(.rela.sbss2.*) 164178170Simp *(.rela.gnu.linkonce.sb2.*) 165178170Simp } 166178170Simp .rel.bss : 167178170Simp { 168178170Simp *(.rel.bss) 169178170Simp *(.rel.bss.*) 170178170Simp *(.rel.gnu.linkonce.b.*) 171178170Simp } 172178170Simp .rela.bss : 173178170Simp { 174178170Simp *(.rela.bss) 175178170Simp *(.rela.bss.*) 176178170Simp *(.rela.gnu.linkonce.b.*) 177178170Simp } 178178170Simp .rel.plt : { *(.rel.plt) } 179178170Simp .rela.plt : { *(.rela.plt) } 180178170Simp .init : 181178170Simp { 182178170Simp KEEP (*(.init)) 183183815Sbms } :text =0x1000000 184183815Sbms .text : 185183815Sbms { 186183815Sbms *(.trap) 187183815Sbms *(.text) 188183815Sbms *(.text.*) 189183815Sbms *(.stub) 190183815Sbms /* .gnu.warning sections are handled specially by elf32.em. */ 191183815Sbms *(.gnu.warning) 192183815Sbms *(.gnu.linkonce.t.*) 193183815Sbms } =0x1000000 194178170Simp .fini : 195178170Simp { 196178170Simp KEEP (*(.fini)) 197178170Simp } =0x1000000 198178170Simp PROVIDE (__etext = .); 199178170Simp PROVIDE (_etext = .); 200178170Simp PROVIDE (etext = .); 201178170Simp .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) } 202178170Simp .rodata1 : { *(.rodata1) } 203178170Simp .reginfo : { *(.reginfo) } 204178170Simp .sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) } 205178170Simp .sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) } 206178170Simp . = ALIGN(0x2000) + (. & (0x2000 - 1)); 207178170Simp .data : 208178170Simp { 209178170Simp *(.data) 210178170Simp *(.data.*) 211178170Simp *(.gnu.linkonce.d.*) 212178170Simp SORT(CONSTRUCTORS) 213183815Sbms } :data 214178170Simp .data1 : { *(.data1) } 215178170Simp .eh_frame : { KEEP (*(.eh_frame)) } 216178170Simp .gcc_except_table : { *(.gcc_except_table) } 217178170Simp .ctors : 218178170Simp { 219178170Simp /* gcc uses crtbegin.o to find the start of 220178170Simp the constructors, so we make sure it is 221178170Simp first. Because this is a wildcard, it 222178170Simp doesn't matter if the user does not 223178170Simp actually link against crtbegin.o; the 224178170Simp linker won't look for a file to match a 225178170Simp wildcard. The wildcard also means that it 226178170Simp doesn't matter which directory crtbegin.o 227178170Simp is in. */ 228178170Simp KEEP (*crtbegin.o(.ctors)) 229178170Simp /* We don't want to include the .ctor section from 230178170Simp from the crtend.o file until after the sorted ctors. 231178170Simp The .ctor section from the crtend file contains the 232178170Simp end of ctors marker and it must be last */ 233178170Simp KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) 234178170Simp KEEP (*(SORT(.ctors.*))) 235178170Simp KEEP (*(.ctors)) 236178170Simp } 237178170Simp .dtors : 238178170Simp { 239178170Simp KEEP (*crtbegin.o(.dtors)) 240178170Simp KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) 241178170Simp KEEP (*(SORT(.dtors.*))) 242178170Simp KEEP (*(.dtors)) 243178170Simp } 244178170Simp .plt : { *(.plt) } 245178170Simp _gp = ALIGN(16) + 0x7ff0; 246178170Simp .got : { *(.got.plt) *(.got) } 247183815Sbms .dynamic : { *(.dynamic) } :dynamic 248178170Simp /* We want the small data sections together, so single-instruction offsets 249178170Simp can access them all, and initialized data all before uninitialized, so 250178170Simp we can shorten the on-disk segment size. */ 251178170Simp .sdata : 252178170Simp { 253178170Simp *(.sdata) 254178170Simp *(.sdata.*) 255178170Simp *(.gnu.linkonce.s.*) 256178170Simp } 257178170Simp _edata = .; 258178170Simp PROVIDE (edata = .); 259178170Simp __bss_start = .; 260178170Simp .sbss : 261178170Simp { 262178170Simp PROVIDE (__sbss_start = .); 263178170Simp PROVIDE (___sbss_start = .); 264178170Simp *(.dynsbss) 265178170Simp *(.sbss) 266178170Simp *(.sbss.*) 267178170Simp *(.gnu.linkonce.sb.*) 268178170Simp *(.scommon) 269178170Simp PROVIDE (__sbss_end = .); 270178170Simp PROVIDE (___sbss_end = .); 271178170Simp } 272178170Simp .bss : 273178170Simp { 274178170Simp *(.dynbss) 275178170Simp *(.bss) 276178170Simp *(.bss.*) 277178170Simp *(.gnu.linkonce.b.*) 278178170Simp *(COMMON) 279178170Simp /* Align here to ensure that the .bss section occupies space up to 280178170Simp _end. Align after .bss to ensure correct alignment even if the 281178170Simp .bss section disappears because there are no input sections. */ 282178170Simp . = ALIGN(64 / 8); 283178170Simp } 284178170Simp . = ALIGN(64 / 8); 285178170Simp _end = .; 286178170Simp PROVIDE (end = .); 287178170Simp /* Stabs debugging sections. */ 288178170Simp .stab 0 : { *(.stab) } 289178170Simp .stabstr 0 : { *(.stabstr) } 290178170Simp .stab.excl 0 : { *(.stab.excl) } 291178170Simp .stab.exclstr 0 : { *(.stab.exclstr) } 292178170Simp .stab.index 0 : { *(.stab.index) } 293178170Simp .stab.indexstr 0 : { *(.stab.indexstr) } 294178170Simp .comment 0 : { *(.comment) } 295178170Simp /* DWARF debug sections. 296178170Simp Symbols in the DWARF debugging sections are relative to the beginning 297178170Simp of the section so we begin them at 0. */ 298178170Simp /* DWARF 1 */ 299178170Simp .debug 0 : { *(.debug) } 300178170Simp .line 0 : { *(.line) } 301178170Simp /* GNU DWARF 1 extensions */ 302178170Simp .debug_srcinfo 0 : { *(.debug_srcinfo) } 303178170Simp .debug_sfnames 0 : { *(.debug_sfnames) } 304178170Simp /* DWARF 1.1 and DWARF 2 */ 305178170Simp .debug_aranges 0 : { *(.debug_aranges) } 306178170Simp .debug_pubnames 0 : { *(.debug_pubnames) } 307178170Simp /* DWARF 2 */ 308178170Simp .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } 309178170Simp .debug_abbrev 0 : { *(.debug_abbrev) } 310178170Simp .debug_line 0 : { *(.debug_line) } 311178170Simp .debug_frame 0 : { *(.debug_frame) } 312178170Simp .debug_str 0 : { *(.debug_str) } 313178170Simp .debug_loc 0 : { *(.debug_loc) } 314178170Simp .debug_macinfo 0 : { *(.debug_macinfo) } 315178170Simp /* SGI/MIPS DWARF 2 extensions */ 316178170Simp .debug_weaknames 0 : { *(.debug_weaknames) } 317178170Simp .debug_funcnames 0 : { *(.debug_funcnames) } 318178170Simp .debug_typenames 0 : { *(.debug_typenames) } 319178170Simp .debug_varnames 0 : { *(.debug_varnames) } 320178170Simp /* These must appear regardless of . */ 321178170Simp} 322