1 /* Default linker script, for normal executables */
2 OUTPUT_FORMAT("elf32-i386", "elf32-i386",
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 .rel.init : { *(.rel.init) }
34 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
35 .rel.fini : { *(.rel.fini) }
36 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
37 .rel.data.rel.ro : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
38 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
39 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
40 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
41 .rel.ctors : { *(.rel.ctors) }
42 .rel.dtors : { *(.rel.dtors) }
43 .rel.got : { *(.rel.got) }
44 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
45 .rel.ifunc : { *(.rel.ifunc) }
49 PROVIDE_HIDDEN (__rel_iplt_start = .);
51 PROVIDE_HIDDEN (__rel_iplt_end = .);
57 .plt : { *(.plt) *(.iplt) }
60 *(.text.unlikely .text.*_unlikely)
61 *(.text.exit .text.exit.*)
62 *(.text.startup .text.startup.*)
63 *(.text.hot .text.hot.*)
64 *(.text .stub .text.* .gnu.linkonce.t.*)
65 /* .gnu.warning sections are handled specially by elf32.em. */
72 PROVIDE (__etext = .);
75 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
76 .rodata1 : { *(.rodata1) }
77 .eh_frame_hdr : { *(.eh_frame_hdr) }
78 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
79 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
80 .gcc_except_table.*) }
81 /* These sections are generated by the Sun/Oracle C++ compiler. */
82 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
84 /* Adjust the address for the data segment. We want to adjust up to
85 the same address within the page on the next page up. */
86 . = ALIGN (kernmxps) - ((kernmxps - .) & (kernmxps - 1));
87 . = DATA_SEGMENT_ALIGN (kernmxps, kernpage);
88 /* Exception handling */
89 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
90 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
91 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
92 /* Thread Local Storage sections */
93 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
94 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
97 PROVIDE_HIDDEN (__preinit_array_start = .);
98 KEEP (*(.preinit_array))
99 PROVIDE_HIDDEN (__preinit_array_end = .);
103 PROVIDE_HIDDEN (__init_array_start = .);
104 KEEP (*(SORT(.init_array.*)))
105 KEEP (*(.init_array))
106 PROVIDE_HIDDEN (__init_array_end = .);
110 PROVIDE_HIDDEN (__fini_array_start = .);
111 KEEP (*(SORT(.fini_array.*)))
112 KEEP (*(.fini_array))
113 PROVIDE_HIDDEN (__fini_array_end = .);
116 PROVIDE (start_ctors = .);
119 /* gcc uses crtbegin.o to find the start of
120 the constructors, so we make sure it is
121 first. Because this is a wildcard, it
122 doesn't matter if the user does not
123 actually link against crtbegin.o; the
124 linker won't look for a file to match a
125 wildcard. The wildcard also means that it
126 doesn't matter which directory crtbegin.o
128 KEEP (*crtbegin.o(.ctors))
129 KEEP (*crtbegin?.o(.ctors))
130 /* We don't want to include the .ctor section from
131 the crtend.o file until after the sorted ctors.
132 The .ctor section from the crtend file contains the
133 end of ctors marker and it must be last */
134 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
135 KEEP (*(SORT(.ctors.*)))
139 PROVIDE (stop_ctors = .);
142 KEEP (*crtbegin.o(.dtors))
143 KEEP (*crtbegin?.o(.dtors))
144 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
145 KEEP (*(SORT(.dtors.*)))
148 .jcr : { KEEP (*(.jcr)) }
149 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } :data
150 .dynamic : { *(.dynamic) } :data :dynamic
151 .got : { *(.got) *(.igot) } :data
152 . = DATA_SEGMENT_RELRO_END (12, .);
153 .got.plt : { *(.got.plt) *(.igot.plt) }
156 *(.data .data.* .gnu.linkonce.d.*)
159 .data1 : { *(.data1) }
160 _edata = .; PROVIDE (edata = .);
165 *(.bss .bss.* .gnu.linkonce.b.*)
167 /* Align here to ensure that the .bss section occupies space up to
168 _end. Align after .bss to ensure correct alignment even if the
169 .bss section disappears because there are no input sections.
170 FIXME: Why do we need it? When there is no .bss section, we don't
171 pad the .data section. */
172 . = ALIGN(. != 0 ? 32 / 8 : 1);
176 _end = .; PROVIDE (end = .);
177 . = DATA_SEGMENT_END (.);
178 /* Stabs debugging sections. */
179 .stab 0 : { *(.stab) }
180 .stabstr 0 : { *(.stabstr) }
181 .stab.excl 0 : { *(.stab.excl) }
182 .stab.exclstr 0 : { *(.stab.exclstr) }
183 .stab.index 0 : { *(.stab.index) }
184 .stab.indexstr 0 : { *(.stab.indexstr) }
185 .comment 0 : { *(.comment) }
186 /* DWARF debug sections.
187 Symbols in the DWARF debugging sections are relative to the beginning
188 of the section so we begin them at 0. */
190 .debug 0 : { *(.debug) }
191 .line 0 : { *(.line) }
192 /* GNU DWARF 1 extensions */
193 .debug_srcinfo 0 : { *(.debug_srcinfo) }
194 .debug_sfnames 0 : { *(.debug_sfnames) }
195 /* DWARF 1.1 and DWARF 2 */
196 .debug_aranges 0 : { *(.debug_aranges) }
197 .debug_pubnames 0 : { *(.debug_pubnames) }
199 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
200 .debug_abbrev 0 : { *(.debug_abbrev) }
201 .debug_line 0 : { *(.debug_line) }
202 .debug_frame 0 : { *(.debug_frame) }
203 .debug_str 0 : { *(.debug_str) }
204 .debug_loc 0 : { *(.debug_loc) }
205 .debug_macinfo 0 : { *(.debug_macinfo) }
206 /* SGI/MIPS DWARF 2 extensions */
207 .debug_weaknames 0 : { *(.debug_weaknames) }
208 .debug_funcnames 0 : { *(.debug_funcnames) }
209 .debug_typenames 0 : { *(.debug_typenames) }
210 .debug_varnames 0 : { *(.debug_varnames) }
212 .debug_pubtypes 0 : { *(.debug_pubtypes) }
213 .debug_ranges 0 : { *(.debug_ranges) }
214 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
215 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }