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