1/* 2 * $FreeBSD: src/sys/conf/ldscript.amd64,v 1.9 2004/05/29 01:09:00 tjr Exp $ 3 * $DragonFly: src/sys/platform/pc64/conf/ldscript.amd64,v 1.1 2007/09/23 04:29:31 yanyh Exp $ 4 */ 5OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") 6OUTPUT_ARCH(i386:x86-64) 7ENTRY(btext) 8SEARCH_DIR("/usr/lib"); 9SECTIONS 10{ 11 /* Read-only sections, merged into text segment: */ 12 . = kernbase + 0x00100000 + SIZEOF_HEADERS; 13 .interp : { *(.interp) } 14 .hash : { *(.hash) } 15 .dynsym : { *(.dynsym) } 16 .dynstr : { *(.dynstr) } 17 .gnu.version : { *(.gnu.version) } 18 .gnu.version_d : { *(.gnu.version_d) } 19 .gnu.version_r : { *(.gnu.version_r) } 20 .rel.init : { *(.rel.init) } 21 .rela.init : { *(.rela.init) } 22 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 23 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } 24 .rel.fini : { *(.rel.fini) } 25 .rela.fini : { *(.rela.fini) } 26 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } 27 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } 28 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 29 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } 30 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 31 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } 32 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 33 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 34 .rel.ctors : { *(.rel.ctors) } 35 .rela.ctors : { *(.rela.ctors) } 36 .rel.dtors : { *(.rel.dtors) } 37 .rela.dtors : { *(.rela.dtors) } 38 .rel.got : { *(.rel.got) } 39 .rela.got : { *(.rela.got) } 40 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 41 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 42 .rel.plt : { *(.rel.plt) } 43 .rela.plt : { *(.rela.plt) } 44 .init : 45 { 46 KEEP (*(.init)) 47 } =0x90909090 48 .plt : { *(.plt) } 49 .text : 50 { 51 *(.text .stub .text.* .gnu.linkonce.t.*) 52 /* .gnu.warning sections are handled specially by elf32.em. */ 53 *(.gnu.warning) 54 } =0x90909090 55 .fini : 56 { 57 KEEP (*(.fini)) 58 } =0x90909090 59 PROVIDE (__etext = .); 60 PROVIDE (_etext = .); 61 PROVIDE (etext = .); 62 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } 63 .rodata1 : { *(.rodata1) } 64 .eh_frame_hdr : { *(.eh_frame_hdr) } 65 /* Adjust the address for the data segment. We want to adjust up to 66 the same address within the page on the next page up. */ 67 . = DATA_SEGMENT_ALIGN(0x100000, 0x1000); 68 /* Ensure the __preinit_array_start label is properly aligned. We 69 could instead move the label definition inside the section, but 70 the linker would then create the section even if it turns out to 71 be empty, which isn't pretty. */ 72 . = ALIGN(64 / 8); 73 PROVIDE (__preinit_array_start = .); 74 .preinit_array : { *(.preinit_array) } 75 PROVIDE (__preinit_array_end = .); 76 PROVIDE (__init_array_start = .); 77 .init_array : { *(.init_array) } 78 PROVIDE (__init_array_end = .); 79 PROVIDE (__fini_array_start = .); 80 .fini_array : { *(.fini_array) } 81 PROVIDE (__fini_array_end = .); 82 .data : 83 { 84 *(.data .data.* .gnu.linkonce.d.*) 85 SORT(CONSTRUCTORS) 86 } 87 .data1 : { *(.data1) } 88 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } 89 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 90 .eh_frame : { KEEP (*(.eh_frame)) } 91 .gcc_except_table : { *(.gcc_except_table) } 92 .dynamic : { *(.dynamic) } 93 _start_ctors = .; 94 PROVIDE (start_ctors = .); 95 .ctors : 96 { 97 /* gcc uses crtbegin.o to find the start of 98 the constructors, so we make sure it is 99 first. Because this is a wildcard, it 100 doesn't matter if the user does not 101 actually link against crtbegin.o; the 102 linker won't look for a file to match a 103 wildcard. The wildcard also means that it 104 doesn't matter which directory crtbegin.o 105 is in. */ 106 KEEP (*crtbegin.o(.ctors)) 107 /* We don't want to include the .ctor section from 108 from the crtend.o file until after the sorted ctors. 109 The .ctor section from the crtend file contains the 110 end of ctors marker and it must be last */ 111 KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) 112 KEEP (*(SORT(.ctors.*))) 113 KEEP (*(.ctors)) 114 } 115 _stop_ctors = .; 116 PROVIDE (stop_ctors = .); 117 .dtors : 118 { 119 KEEP (*crtbegin.o(.dtors)) 120 KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) 121 KEEP (*(SORT(.dtors.*))) 122 KEEP (*(.dtors)) 123 } 124 .jcr : { KEEP (*(.jcr)) } 125 .got : { *(.got.plt) *(.got) } 126 _edata = .; 127 PROVIDE (edata = .); 128 __bss_start = .; 129 .bss : 130 { 131 *(.dynbss) 132 *(.bss .bss.* .gnu.linkonce.b.*) 133 *(COMMON) 134 /* Align here to ensure that the .bss section occupies space up to 135 _end. Align after .bss to ensure correct alignment even if the 136 .bss section disappears because there are no input sections. */ 137 . = ALIGN(64 / 8); 138 } 139 . = ALIGN(64 / 8); 140 _end = .; 141 PROVIDE (end = .); 142 . = DATA_SEGMENT_END (.); 143 /* Stabs debugging sections. */ 144 .stab 0 : { *(.stab) } 145 .stabstr 0 : { *(.stabstr) } 146 .stab.excl 0 : { *(.stab.excl) } 147 .stab.exclstr 0 : { *(.stab.exclstr) } 148 .stab.index 0 : { *(.stab.index) } 149 .stab.indexstr 0 : { *(.stab.indexstr) } 150 .comment 0 : { *(.comment) } 151 /* DWARF debug sections. 152 Symbols in the DWARF debugging sections are relative to the beginning 153 of the section so we begin them at 0. */ 154 /* DWARF 1 */ 155 .debug 0 : { *(.debug) } 156 .line 0 : { *(.line) } 157 /* GNU DWARF 1 extensions */ 158 .debug_srcinfo 0 : { *(.debug_srcinfo) } 159 .debug_sfnames 0 : { *(.debug_sfnames) } 160 /* DWARF 1.1 and DWARF 2 */ 161 .debug_aranges 0 : { *(.debug_aranges) } 162 .debug_pubnames 0 : { *(.debug_pubnames) } 163 /* DWARF 2 */ 164 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 165 .debug_abbrev 0 : { *(.debug_abbrev) } 166 .debug_line 0 : { *(.debug_line) } 167 .debug_frame 0 : { *(.debug_frame) } 168 .debug_str 0 : { *(.debug_str) } 169 .debug_loc 0 : { *(.debug_loc) } 170 .debug_macinfo 0 : { *(.debug_macinfo) } 171 /* SGI/MIPS DWARF 2 extensions */ 172 .debug_weaknames 0 : { *(.debug_weaknames) } 173 .debug_funcnames 0 : { *(.debug_funcnames) } 174 .debug_typenames 0 : { *(.debug_typenames) } 175 .debug_varnames 0 : { *(.debug_varnames) } 176} 177