1 /* Default linker script, for normal executables */
2 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
4 OUTPUT_ARCH(i386:x86-64)
6 SEARCH_DIR("/usr/lib");
10 headers PT_PHDR PHDRS ;
12 text PT_LOAD FILEHDR PHDRS ;
19 /* Read-only sections, merged into text segment: */
21 kernmxps = CONSTANT (MAXPAGESIZE);
22 kernpage = CONSTANT (COMMONPAGESIZE);
23 . = kernbase + kernphys + SIZEOF_HEADERS;
24 .interp : { *(.interp) } :text :interp
25 .note.gnu.build-id : { *(.note.gnu.build-id) } :text
27 .gnu.hash : { *(.gnu.hash) }
28 .dynsym : { *(.dynsym) }
29 .dynstr : { *(.dynstr) }
30 .gnu.version : { *(.gnu.version) }
31 .gnu.version_d : { *(.gnu.version_d) }
32 .gnu.version_r : { *(.gnu.version_r) }
33 .rela.init : { *(.rela.init) }
34 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
35 .rela.fini : { *(.rela.fini) }
36 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
37 .rela.data.rel.ro : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
38 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
39 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
40 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
41 .rela.ctors : { *(.rela.ctors) }
42 .rela.dtors : { *(.rela.dtors) }
43 .rela.got : { *(.rela.got) }
44 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
45 .rela.ldata : { *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) }
46 .rela.lbss : { *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) }
47 .rela.lrodata : { *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) }
48 .rela.ifunc : { *(.rela.ifunc) }
52 PROVIDE_HIDDEN (__rela_iplt_start = .);
54 PROVIDE_HIDDEN (__rela_iplt_end = .);
60 .plt : { *(.plt) *(.iplt) }
63 *(.text.unlikely .text.*_unlikely)
64 *(.text.exit .text.exit.*)
65 *(.text.startup .text.startup.*)
66 *(.text.hot .text.hot.*)
67 *(.text .stub .text.* .gnu.linkonce.t.*)
68 /* .gnu.warning sections are handled specially by elf32.em. */
75 PROVIDE (__etext = .);
78 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
79 .rodata1 : { *(.rodata1) }
80 .eh_frame_hdr : { *(.eh_frame_hdr) }
81 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
82 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
83 .gcc_except_table.*) }
84 /* These sections are generated by the Sun/Oracle C++ compiler. */
85 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
87 /* Adjust the address for the data segment. We want to adjust up to
88 the same address within the page on the next page up. */
89 . = ALIGN (kernmxps) - ((kernmxps - .) & (kernmxps - 1));
90 . = DATA_SEGMENT_ALIGN (kernmxps, kernpage);
91 /* Exception handling */
92 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
93 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
94 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
95 /* Thread Local Storage sections */
96 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
97 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
100 PROVIDE_HIDDEN (__preinit_array_start = .);
101 KEEP (*(.preinit_array))
102 PROVIDE_HIDDEN (__preinit_array_end = .);
106 PROVIDE_HIDDEN (__init_array_start = .);
107 KEEP (*(SORT(.init_array.*)))
108 KEEP (*(.init_array))
109 PROVIDE_HIDDEN (__init_array_end = .);
113 PROVIDE_HIDDEN (__fini_array_start = .);
114 KEEP (*(SORT(.fini_array.*)))
115 KEEP (*(.fini_array))
116 PROVIDE_HIDDEN (__fini_array_end = .);
119 PROVIDE (start_ctors = .);
122 /* gcc uses crtbegin.o to find the start of
123 the constructors, so we make sure it is
124 first. Because this is a wildcard, it
125 doesn't matter if the user does not
126 actually link against crtbegin.o; the
127 linker won't look for a file to match a
128 wildcard. The wildcard also means that it
129 doesn't matter which directory crtbegin.o
131 KEEP (*crtbegin.o(.ctors))
132 KEEP (*crtbegin?.o(.ctors))
133 /* We don't want to include the .ctor section from
134 the crtend.o file until after the sorted ctors.
135 The .ctor section from the crtend file contains the
136 end of ctors marker and it must be last */
137 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
138 KEEP (*(SORT(.ctors.*)))
142 PROVIDE (stop_ctors = .);
145 KEEP (*crtbegin.o(.dtors))
146 KEEP (*crtbegin?.o(.dtors))
147 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
148 KEEP (*(SORT(.dtors.*)))
151 .jcr : { KEEP (*(.jcr)) }
152 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } :data
153 .dynamic : { *(.dynamic) } :data :dynamic
154 .got : { *(.got) *(.igot) } :data
155 . = DATA_SEGMENT_RELRO_END (24, .);
156 .got.plt : { *(.got.plt) *(.igot.plt) }
159 *(.data .data.* .gnu.linkonce.d.*)
162 .data1 : { *(.data1) }
163 _edata = .; PROVIDE (edata = .);
168 *(.bss .bss.* .gnu.linkonce.b.*)
170 /* Align here to ensure that the .bss section occupies space up to
171 _end. Align after .bss to ensure correct alignment even if the
172 .bss section disappears because there are no input sections.
173 FIXME: Why do we need it? When there is no .bss section, we don't
174 pad the .data section. */
175 . = ALIGN(. != 0 ? 64 / 8 : 1);
180 *(.lbss .lbss.* .gnu.linkonce.lb.*)
184 .lrodata ALIGN(kernmxps) + (. & (kernmxps - 1)) :
186 *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
188 .ldata ALIGN(kernmxps) + (. & (kernmxps - 1)) :
190 *(.ldata .ldata.* .gnu.linkonce.l.*)
191 . = ALIGN(. != 0 ? 64 / 8 : 1);
194 _end = .; PROVIDE (end = .);
195 . = DATA_SEGMENT_END (.);
196 /* Stabs debugging sections. */
197 .stab 0 : { *(.stab) }
198 .stabstr 0 : { *(.stabstr) }
199 .stab.excl 0 : { *(.stab.excl) }
200 .stab.exclstr 0 : { *(.stab.exclstr) }
201 .stab.index 0 : { *(.stab.index) }
202 .stab.indexstr 0 : { *(.stab.indexstr) }
203 .comment 0 : { *(.comment) }
204 /* DWARF debug sections.
205 Symbols in the DWARF debugging sections are relative to the beginning
206 of the section so we begin them at 0. */
208 .debug 0 : { *(.debug) }
209 .line 0 : { *(.line) }
210 /* GNU DWARF 1 extensions */
211 .debug_srcinfo 0 : { *(.debug_srcinfo) }
212 .debug_sfnames 0 : { *(.debug_sfnames) }
213 /* DWARF 1.1 and DWARF 2 */
214 .debug_aranges 0 : { *(.debug_aranges) }
215 .debug_pubnames 0 : { *(.debug_pubnames) }
217 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
218 .debug_abbrev 0 : { *(.debug_abbrev) }
219 .debug_line 0 : { *(.debug_line) }
220 .debug_frame 0 : { *(.debug_frame) }
221 .debug_str 0 : { *(.debug_str) }
222 .debug_loc 0 : { *(.debug_loc) }
223 .debug_macinfo 0 : { *(.debug_macinfo) }
224 /* SGI/MIPS DWARF 2 extensions */
225 .debug_weaknames 0 : { *(.debug_weaknames) }
226 .debug_funcnames 0 : { *(.debug_funcnames) }
227 .debug_typenames 0 : { *(.debug_typenames) }
228 .debug_varnames 0 : { *(.debug_varnames) }
230 .debug_pubtypes 0 : { *(.debug_pubtypes) }
231 .debug_ranges 0 : { *(.debug_ranges) }
232 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
233 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }