Debian Codegraph @

ldscripts/elf_x86_64.xBDT

raw
1 /* Linker script for normal executables with text data and BSS in hugepages */
2 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
3 "elf64-x86-64")
4 OUTPUT_ARCH(i386:x86-64)
5 ENTRY(_start)
6 SEARCH_DIR("/usr/x86_64-linux-gnu/lib64"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/x86_64-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
7 INPUT(-lhugetlbfs);
8 /* Do we need any of these for elf?
9 __DYNAMIC = 0; */
10 PHDRS
11 {
12 headers PT_PHDR PHDRS ;
13 interp PT_INTERP ;
14 htext PT_LOAD FILEHDR PHDRS FLAGS (0x00100005);
15 hdata PT_LOAD FLAGS (0x00100007);
16 dynamic PT_DYNAMIC ;
17 note PT_NOTE ;
18 gnu_stack PT_GNU_STACK ;
19 /* this is the value of PT_GNU_EH_FRAME as defined in
20 usr/include/elf.h but binutils does not recognize that identifier
21 as it does other PT_ constants. */
22 eh_frame_hdr 1685382480 FLAGS (0x00000004);
23 }
24 SECTIONS
25 {
26 /* Read-only sections, merged into text segment: */
27 /* Different from the normal origin address, because we make it 16MB
28 * aligned, in case of future larger hugepages */
29 __executable_start = 0x1000000; . = 0x1000000 + SIZEOF_HEADERS;
30 .interp : { *(.interp) } :interp :htext
31 .hash : { *(.hash) } :htext
32 .note.SuSE : { *(.note.SuSE) } :htext :note
33 .note.ABI-tag : { *(.note.ABI-tag) } :htext :note
34 .note.gnu.build-id : { *(.note.gnu.build-id) } :htext :note
35 .dynsym : { *(.dynsym) } :htext
36 .dynstr : { *(.dynstr) } :htext
37 .gnu.version : { *(.gnu.version) } :htext
38 .gnu.version_d : { *(.gnu.version_d) } :htext
39 .gnu.version_r : { *(.gnu.version_r) } :htext
40 .rel.init : { *(.rel.init) } :htext
41 .rela.init : { *(.rela.init) } :htext
42 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } :htext
43 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } :htext
44 .rel.fini : { *(.rel.fini) } :htext
45 .rela.fini : { *(.rela.fini) } :htext
46 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } :htext
47 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } :htext
48 .rel.data.rel.ro : { *(.rel.data.rel.ro*) } :htext
49 .rela.data.rel.ro : { *(.rel.data.rel.ro*) } :htext
50 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } :htext
51 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } :htext
52 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } :htext
53 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } :htext
54 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } :htext
55 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } :htext
56 .rel.ctors : { *(.rel.ctors) } :htext
57 .rela.ctors : { *(.rela.ctors) } :htext
58 .rel.dtors : { *(.rel.dtors) } :htext
59 .rela.dtors : { *(.rela.dtors) } :htext
60 .rel.got : { *(.rel.got) } :htext
61 .rela.got : { *(.rela.got) } :htext
62 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } :htext
63 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } :htext
64 .rel.plt : { *(.rel.plt) } :htext
65 .rela.plt : { *(.rela.plt) } :htext
66 .init :
67 {
68 KEEP (*(.init))
69 } :htext =0x90909090
70 .plt : { *(.plt) } :htext
71 .text :
72 {
73 *(.text .stub .text.* .gnu.linkonce.t.*)
74 KEEP (*(.text.*personality*))
75 /* .gnu.warning sections are handled specially by elf32.em. */
76 *(.gnu.warning)
77 } :htext =0x90909090
78 .fini :
79 {
80 KEEP (*(.fini))
81 } :htext =0x90909090
82 PROVIDE (__etext = .);
83 PROVIDE (_etext = .);
84 PROVIDE (etext = .);
85 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } :htext
86 .rodata1 : { *(.rodata1) } :htext
87 .eh_frame_hdr : { *(.eh_frame_hdr) } :htext :eh_frame_hdr
88 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } :htext
89 .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } :htext
90 /* We don't maintain address congruence here, because saving
91 * hugepages is more important than saving executable size. */
92 . = ALIGN (0x1000000); /* Align to 16MB (4MB hugepage size, plus some slack in case of larger hugepages in future */
93 /* Exception handling */
94 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } :hdata
95 .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } :hdata
96 /* Thread Local Storage sections */
97 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } :hdata
98 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } :hdata
99 /* Ensure the __preinit_array_start label is properly aligned. We
100 could instead move the label definition inside the section, but
101 the linker would then create the section even if it turns out to
102 be empty, which isn't pretty. */
103 . = ALIGN(64 / 8);
104 PROVIDE (__preinit_array_start = .);
105 .preinit_array : { KEEP (*(.preinit_array)) } :hdata
106 PROVIDE (__preinit_array_end = .);
107 PROVIDE (__init_array_start = .);
108 .init_array : { KEEP (*(.init_array)) } :hdata
109 PROVIDE (__init_array_end = .);
110 PROVIDE (__fini_array_start = .);
111 .fini_array : { KEEP (*(.fini_array)) } :hdata
112 PROVIDE (__fini_array_end = .);
113 .ctors :
114 {
115 /* gcc uses crtbegin.o to find the start of
116 the constructors, so we make sure it is
117 first. Because this is a wildcard, it
118 doesn't matter if the user does not
119 actually link against crtbegin.o; the
120 linker won't look for a file to match a
121 wildcard. The wildcard also means that it
122 doesn't matter which directory crtbegin.o
123 is in. */
124 KEEP (*crtbegin*.o(.ctors))
125 /* We don't want to include the .ctor section from
126 from the crtend.o file until after the sorted ctors.
127 The .ctor section from the crtend file contains the
128 end of ctors marker and it must be last */
129 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
130 KEEP (*(SORT(.ctors.*)))
131 KEEP (*(.ctors))
132 } :hdata
133 .dtors :
134 {
135 KEEP (*crtbegin*.o(.dtors))
136 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
137 KEEP (*(SORT(.dtors.*)))
138 KEEP (*(.dtors))
139 } :hdata
140 .jcr : { KEEP (*(.jcr)) } :hdata
141 .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } :hdata
142 .dynamic : { *(.dynamic) } :dynamic :hdata
143 .got : { *(.got) } :hdata
144 .got.plt : { *(.got.plt) } :hdata
145 .data :
146 {
147 *(.data .data.* .gnu.linkonce.d.*)
148 KEEP (*(.gnu.linkonce.d.*personality*))
149 SORT(CONSTRUCTORS)
150 } :hdata
151 .data1 : { *(.data1) } :hdata
152 _edata = .;
153 PROVIDE (edata = .);
154 __bss_start = .;
155 .bss :
156 {
157 *(.dynbss)
158 *(.bss .bss.* .gnu.linkonce.b.*)
159 *(COMMON)
160 /* Align here to ensure that the .bss section occupies space up to
161 _end. Align after .bss to ensure correct alignment even if the
162 .bss section disappears because there are no input sections. */
163 . = ALIGN(64 / 8);
164 } :hdata
165 . = ALIGN(64 / 8);
166 _end = .;
167 PROVIDE (end = .);
168 /* Stabs debugging sections. */
169 .stab 0 : { *(.stab) }
170 .stabstr 0 : { *(.stabstr) }
171 .stab.excl 0 : { *(.stab.excl) }
172 .stab.exclstr 0 : { *(.stab.exclstr) }
173 .stab.index 0 : { *(.stab.index) }
174 .stab.indexstr 0 : { *(.stab.indexstr) }
175 .comment 0 : { *(.comment) }
176 /* DWARF debug sections.
177 Symbols in the DWARF debugging sections are relative to the beginning
178 of the section so we begin them at 0. */
179 /* DWARF 1 */
180 .debug 0 : { *(.debug) }
181 .line 0 : { *(.line) }
182 /* GNU DWARF 1 extensions */
183 .debug_srcinfo 0 : { *(.debug_srcinfo) }
184 .debug_sfnames 0 : { *(.debug_sfnames) }
185 /* DWARF 1.1 and DWARF 2 */
186 .debug_aranges 0 : { *(.debug_aranges) }
187 .debug_pubnames 0 : { *(.debug_pubnames) }
188 /* DWARF 2 */
189 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
190 .debug_abbrev 0 : { *(.debug_abbrev) }
191 .debug_line 0 : { *(.debug_line) }
192 .debug_frame 0 : { *(.debug_frame) }
193 .debug_str 0 : { *(.debug_str) }
194 .debug_loc 0 : { *(.debug_loc) }
195 .debug_macinfo 0 : { *(.debug_macinfo) }
196 /* SGI/MIPS DWARF 2 extensions */
197 .debug_weaknames 0 : { *(.debug_weaknames) }
198 .debug_funcnames 0 : { *(.debug_funcnames) }
199 .debug_typenames 0 : { *(.debug_typenames) }
200 .debug_varnames 0 : { *(.debug_varnames) }
201 /DISCARD/ : { *(.note.GNU-stack) }
202 }