11.1Sgarbled/* $NetBSD: ldscript,v 1.1 2008/02/13 20:11:38 garbled Exp $ */ 21.1Sgarbled 31.1Sgarbled/* This only differs from the stock one by the addition of the text name 41.1Sgarbled and the addition of the PHDRS section. 51.1Sgarbled*/ 61.1Sgarbled/* Script for -N: mix text and data on same page; don't align data */ 71.1SgarbledOUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", 81.1Sgarbled "elf32-powerpc") 91.1SgarbledOUTPUT_ARCH(powerpc:common) 101.1SgarbledENTRY(_start) 111.1SgarbledSEARCH_DIR("/usr/src/tools/ppc-hack/powerpc--netbsd/lib"); 121.1Sgarbled/* Do we need any of these for elf? 131.1Sgarbled __DYNAMIC = 0; */ 141.1SgarbledPROVIDE (__stack = 0); PROVIDE (___stack = 0); 151.1SgarbledPHDRS 161.1Sgarbled{ 171.1Sgarbled/* headers PT_PHDR PHDRS ;*/ 181.1Sgarbled text PT_LOAD; 191.1Sgarbled text PT_NOTE; 201.1Sgarbled} 211.1SgarbledSECTIONS 221.1Sgarbled{ 231.1Sgarbled /* Read-only sections, merged into text segment: */ 241.1Sgarbled PROVIDE (__executable_start = 0x0); . = 0x0 + SIZEOF_HEADERS; 251.1Sgarbled .interp : { *(.interp) } 261.1Sgarbled .hash : { *(.hash) } 271.1Sgarbled .dynsym : { *(.dynsym) } 281.1Sgarbled .dynstr : { *(.dynstr) } 291.1Sgarbled .gnu.version : { *(.gnu.version) } 301.1Sgarbled .gnu.version_d : { *(.gnu.version_d) } 311.1Sgarbled .gnu.version_r : { *(.gnu.version_r) } 321.1Sgarbled .rel.init : { *(.rel.init) } 331.1Sgarbled .rela.init : { *(.rela.init) } 341.1Sgarbled .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 351.1Sgarbled .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 361.1Sgarbled .rel.fini : { *(.rel.fini) } 371.1Sgarbled .rela.fini : { *(.rela.fini) } 381.1Sgarbled .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 391.1Sgarbled .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 401.1Sgarbled .rel.data.rel.ro : { *(.rel.data.rel.ro*) } 411.1Sgarbled .rela.data.rel.ro : { *(.rel.data.rel.ro*) } 421.1Sgarbled .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 431.1Sgarbled .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 441.1Sgarbled .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 451.1Sgarbled .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 461.1Sgarbled .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 471.1Sgarbled .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 481.1Sgarbled .rel.ctors : { *(.rel.ctors) } 491.1Sgarbled .rela.ctors : { *(.rela.ctors) } 501.1Sgarbled .rel.dtors : { *(.rel.dtors) } 511.1Sgarbled .rela.dtors : { *(.rela.dtors) } 521.1Sgarbled .rel.got : { *(.rel.got) } 531.1Sgarbled .rela.got : { *(.rela.got) } 541.1Sgarbled .rela.got1 : { *(.rela.got1) } 551.1Sgarbled .rela.got2 : { *(.rela.got2) } 561.1Sgarbled .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) } 571.1Sgarbled .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) } 581.1Sgarbled .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) } 591.1Sgarbled .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) } 601.1Sgarbled .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) } 611.1Sgarbled .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) } 621.1Sgarbled .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) } 631.1Sgarbled .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) } 641.1Sgarbled .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 651.1Sgarbled .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 661.1Sgarbled .rel.plt : { *(.rel.plt) } 671.1Sgarbled .rela.plt : { *(.rela.plt) } 681.1Sgarbled .init : 691.1Sgarbled { 701.1Sgarbled KEEP (*(.init)) 711.1Sgarbled } =0 721.1Sgarbled .text : 731.1Sgarbled { 741.1Sgarbled *(.text .stub .text.* .gnu.linkonce.t.*) 751.1Sgarbled KEEP (*(.text.*personality*)) 761.1Sgarbled /* .gnu.warning sections are handled specially by elf32.em. */ 771.1Sgarbled *(.gnu.warning) 781.1Sgarbled } :text 791.1Sgarbled .fini : 801.1Sgarbled { 811.1Sgarbled KEEP (*(.fini)) 821.1Sgarbled } =0 831.1Sgarbled PROVIDE (__etext = .); 841.1Sgarbled PROVIDE (_etext = .); 851.1Sgarbled PROVIDE (etext = .); 861.1Sgarbled .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 871.1Sgarbled .rodata1 : { *(.rodata1) } 881.1Sgarbled .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } 891.1Sgarbled .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } 901.1Sgarbled .eh_frame_hdr : { *(.eh_frame_hdr) } 911.1Sgarbled .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } 921.1Sgarbled .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } 931.1Sgarbled /* Adjust the address for the data segment. We want to adjust up to 941.1Sgarbled the same address within the page on the next page up. */ 951.1Sgarbled . = .; 961.1Sgarbled /* Exception handling */ 971.1Sgarbled .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } 981.1Sgarbled .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } 991.1Sgarbled /* Thread Local Storage sections */ 1001.1Sgarbled .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 1011.1Sgarbled .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 1021.1Sgarbled /* Ensure the __preinit_array_start label is properly aligned. We 1031.1Sgarbled could instead move the label definition inside the section, but 1041.1Sgarbled the linker would then create the section even if it turns out to 1051.1Sgarbled be empty, which isn't pretty. */ 1061.1Sgarbled . = ALIGN(32 / 8); 1071.1Sgarbled PROVIDE (__preinit_array_start = .); 1081.1Sgarbled .preinit_array : { KEEP (*(.preinit_array)) } 1091.1Sgarbled PROVIDE (__preinit_array_end = .); 1101.1Sgarbled PROVIDE (__init_array_start = .); 1111.1Sgarbled .init_array : { KEEP (*(.init_array)) } 1121.1Sgarbled PROVIDE (__init_array_end = .); 1131.1Sgarbled PROVIDE (__fini_array_start = .); 1141.1Sgarbled .fini_array : { KEEP (*(.fini_array)) } 1151.1Sgarbled PROVIDE (__fini_array_end = .); 1161.1Sgarbled .ctors : 1171.1Sgarbled { 1181.1Sgarbled /* gcc uses crtbegin.o to find the start of 1191.1Sgarbled the constructors, so we make sure it is 1201.1Sgarbled first. Because this is a wildcard, it 1211.1Sgarbled doesn't matter if the user does not 1221.1Sgarbled actually link against crtbegin.o; the 1231.1Sgarbled linker won't look for a file to match a 1241.1Sgarbled wildcard. The wildcard also means that it 1251.1Sgarbled doesn't matter which directory crtbegin.o 1261.1Sgarbled is in. */ 1271.1Sgarbled KEEP (*crtbegin*.o(.ctors)) 1281.1Sgarbled /* We don't want to include the .ctor section from 1291.1Sgarbled from the crtend.o file until after the sorted ctors. 1301.1Sgarbled The .ctor section from the crtend file contains the 1311.1Sgarbled end of ctors marker and it must be last */ 1321.1Sgarbled KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) 1331.1Sgarbled KEEP (*(SORT(.ctors.*))) 1341.1Sgarbled KEEP (*(.ctors)) 1351.1Sgarbled } 1361.1Sgarbled .dtors : 1371.1Sgarbled { 1381.1Sgarbled KEEP (*crtbegin*.o(.dtors)) 1391.1Sgarbled KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) 1401.1Sgarbled KEEP (*(SORT(.dtors.*))) 1411.1Sgarbled KEEP (*(.dtors)) 1421.1Sgarbled } 1431.1Sgarbled .jcr : { KEEP (*(.jcr)) } 1441.1Sgarbled .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } 1451.1Sgarbled .fixup : { *(.fixup) } 1461.1Sgarbled .got1 : { *(.got1) } 1471.1Sgarbled .got2 : { *(.got2) } 1481.1Sgarbled .dynamic : { *(.dynamic) } 1491.1Sgarbled .data : 1501.1Sgarbled { 1511.1Sgarbled *(.data .data.* .gnu.linkonce.d.*) 1521.1Sgarbled KEEP (*(.gnu.linkonce.d.*personality*)) 1531.1Sgarbled SORT(CONSTRUCTORS) 1541.1Sgarbled } 1551.1Sgarbled .data1 : { *(.data1) } 1561.1Sgarbled .got : { *(.got.plt) *(.got) } 1571.1Sgarbled /* We want the small data sections together, so single-instruction offsets 1581.1Sgarbled can access them all, and initialized data all before uninitialized, so 1591.1Sgarbled we can shorten the on-disk segment size. */ 1601.1Sgarbled .sdata : 1611.1Sgarbled { 1621.1Sgarbled *(.sdata .sdata.* .gnu.linkonce.s.*) 1631.1Sgarbled } 1641.1Sgarbled _edata = .; 1651.1Sgarbled PROVIDE (edata = .); 1661.1Sgarbled __bss_start = .; 1671.1Sgarbled .sbss : 1681.1Sgarbled { 1691.1Sgarbled PROVIDE (__sbss_start = .); 1701.1Sgarbled PROVIDE (___sbss_start = .); 1711.1Sgarbled *(.dynsbss) 1721.1Sgarbled *(.sbss .sbss.* .gnu.linkonce.sb.*) 1731.1Sgarbled *(.scommon) 1741.1Sgarbled PROVIDE (__sbss_end = .); 1751.1Sgarbled PROVIDE (___sbss_end = .); 1761.1Sgarbled } 1771.1Sgarbled .plt : { *(.plt) } 1781.1Sgarbled .bss : 1791.1Sgarbled { 1801.1Sgarbled *(.dynbss) 1811.1Sgarbled *(.bss .bss.* .gnu.linkonce.b.*) 1821.1Sgarbled *(COMMON) 1831.1Sgarbled /* Align here to ensure that the .bss section occupies space up to 1841.1Sgarbled _end. Align after .bss to ensure correct alignment even if the 1851.1Sgarbled .bss section disappears because there are no input sections. */ 1861.1Sgarbled . = ALIGN(32 / 8); 1871.1Sgarbled } 1881.1Sgarbled . = ALIGN(32 / 8); 1891.1Sgarbled _end = .; 1901.1Sgarbled __end = .; 1911.1Sgarbled PROVIDE (end = .); 1921.1Sgarbled /* Stabs debugging sections. */ 1931.1Sgarbled .stab 0 : { *(.stab) } 1941.1Sgarbled .stabstr 0 : { *(.stabstr) } 1951.1Sgarbled .stab.excl 0 : { *(.stab.excl) } 1961.1Sgarbled .stab.exclstr 0 : { *(.stab.exclstr) } 1971.1Sgarbled .stab.index 0 : { *(.stab.index) } 1981.1Sgarbled .stab.indexstr 0 : { *(.stab.indexstr) } 1991.1Sgarbled .comment 0 : { *(.comment) } 2001.1Sgarbled /* DWARF debug sections. 2011.1Sgarbled Symbols in the DWARF debugging sections are relative to the beginning 2021.1Sgarbled of the section so we begin them at 0. */ 2031.1Sgarbled /* DWARF 1 */ 2041.1Sgarbled .debug 0 : { *(.debug) } 2051.1Sgarbled .line 0 : { *(.line) } 2061.1Sgarbled /* GNU DWARF 1 extensions */ 2071.1Sgarbled .debug_srcinfo 0 : { *(.debug_srcinfo) } 2081.1Sgarbled .debug_sfnames 0 : { *(.debug_sfnames) } 2091.1Sgarbled /* DWARF 1.1 and DWARF 2 */ 2101.1Sgarbled .debug_aranges 0 : { *(.debug_aranges) } 2111.1Sgarbled .debug_pubnames 0 : { *(.debug_pubnames) } 2121.1Sgarbled /* DWARF 2 */ 2131.1Sgarbled .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 2141.1Sgarbled .debug_abbrev 0 : { *(.debug_abbrev) } 2151.1Sgarbled .debug_line 0 : { *(.debug_line) } 2161.1Sgarbled .debug_frame 0 : { *(.debug_frame) } 2171.1Sgarbled .debug_str 0 : { *(.debug_str) } 2181.1Sgarbled .debug_loc 0 : { *(.debug_loc) } 2191.1Sgarbled .debug_macinfo 0 : { *(.debug_macinfo) } 2201.1Sgarbled /* SGI/MIPS DWARF 2 extensions */ 2211.1Sgarbled .debug_weaknames 0 : { *(.debug_weaknames) } 2221.1Sgarbled .debug_funcnames 0 : { *(.debug_funcnames) } 2231.1Sgarbled .debug_typenames 0 : { *(.debug_typenames) } 2241.1Sgarbled .debug_varnames 0 : { *(.debug_varnames) } 2251.1Sgarbled /DISCARD/ : { *(.note.GNU-stack) } 2261.1Sgarbled} 227