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