1 | /* Script for --enable-auto-import */
|
---|
2 | /* Copyright (C) 2014-2021 Free Software Foundation, Inc.
|
---|
3 | Copying and distribution of this script, with or without modification,
|
---|
4 | are permitted in any medium without royalty provided the copyright
|
---|
5 | notice and this notice are preserved. */
|
---|
6 | OUTPUT_FORMAT(pei-i386)
|
---|
7 | SEARCH_DIR("=/mingw32/i686-w64-mingw32/lib"); SEARCH_DIR("=/mingw32/lib"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
|
---|
8 | SECTIONS
|
---|
9 | {
|
---|
10 | /* Make the virtual address and file offset synced if the alignment is
|
---|
11 | lower than the target page size. */
|
---|
12 | . = SIZEOF_HEADERS;
|
---|
13 | . = ALIGN(__section_alignment__);
|
---|
14 | .text __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) :
|
---|
15 | {
|
---|
16 | KEEP (*(SORT_NONE(.init)))
|
---|
17 | *(.text)
|
---|
18 | *(SORT(.text$*))
|
---|
19 | *(.text.*)
|
---|
20 | *(.gnu.linkonce.t.*)
|
---|
21 | *(.glue_7t)
|
---|
22 | *(.glue_7)
|
---|
23 | /* Note: we always define __CTOR_LIST__ and ___CTOR_LIST__ here,
|
---|
24 | we do not PROVIDE them. This is because the ctors.o startup
|
---|
25 | code in libgcc defines them as common symbols, with the
|
---|
26 | expectation that they will be overridden by the definitions
|
---|
27 | here. If we PROVIDE the symbols then they will not be
|
---|
28 | overridden and global constructors will not be run.
|
---|
29 | See PR 22762 for more details.
|
---|
30 |
|
---|
31 | This does mean that it is not possible for a user to define
|
---|
32 | their own __CTOR_LIST__ and __DTOR_LIST__ symbols; if they do,
|
---|
33 | the content from those variables are included but the symbols
|
---|
34 | defined here silently take precedence. If they truly need to
|
---|
35 | be redefined, a custom linker script will have to be used.
|
---|
36 | (The custom script can just be a copy of this script with the
|
---|
37 | PROVIDE() qualifiers added).
|
---|
38 | In particular this means that ld -Ur does not work, because
|
---|
39 | the proper __CTOR_LIST__ set by ld -Ur is overridden by a
|
---|
40 | bogus __CTOR_LIST__ set by the final link. See PR 46. */
|
---|
41 | ___CTOR_LIST__ = .;
|
---|
42 | __CTOR_LIST__ = .;
|
---|
43 | LONG (-1);
|
---|
44 | KEEP(*(.ctors));
|
---|
45 | KEEP(*(.ctor));
|
---|
46 | KEEP(*(SORT_BY_NAME(.ctors.*)));
|
---|
47 | LONG (0);
|
---|
48 | /* See comment about __CTOR_LIST__ above. The same reasoning
|
---|
49 | applies here too. */
|
---|
50 | ___DTOR_LIST__ = .;
|
---|
51 | __DTOR_LIST__ = .;
|
---|
52 | LONG (-1);
|
---|
53 | KEEP(*(.dtors));
|
---|
54 | KEEP(*(.dtor));
|
---|
55 | KEEP(*(SORT_BY_NAME(.dtors.*)));
|
---|
56 | LONG (0);
|
---|
57 | KEEP (*(SORT_NONE(.fini)))
|
---|
58 | /* ??? Why is .gcc_exc here? */
|
---|
59 | *(.gcc_exc)
|
---|
60 | PROVIDE (etext = .);
|
---|
61 | PROVIDE (_etext = .);
|
---|
62 | KEEP (*(.gcc_except_table))
|
---|
63 | }
|
---|
64 | /* The Cygwin32 library uses a section to avoid copying certain data
|
---|
65 | on fork. This used to be named ".data". The linker used
|
---|
66 | to include this between __data_start__ and __data_end__, but that
|
---|
67 | breaks building the cygwin32 dll. Instead, we name the section
|
---|
68 | ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
|
---|
69 | .data BLOCK(__section_alignment__) :
|
---|
70 | {
|
---|
71 | __data_start__ = . ;
|
---|
72 | *(.data)
|
---|
73 | *(.data2)
|
---|
74 | *(SORT(.data$*))
|
---|
75 | *(.rdata)
|
---|
76 | *(SORT(.rdata$*))
|
---|
77 | KEEP(*(.jcr))
|
---|
78 | __data_end__ = . ;
|
---|
79 | *(.data_cygwin_nocopy)
|
---|
80 | }
|
---|
81 | .rdata BLOCK(__section_alignment__) :
|
---|
82 | {
|
---|
83 | . = ALIGN(4);
|
---|
84 | __rt_psrelocs_start = .;
|
---|
85 | KEEP(*(.rdata_runtime_pseudo_reloc))
|
---|
86 | __rt_psrelocs_end = .;
|
---|
87 | }
|
---|
88 | __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;
|
---|
89 | ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
|
---|
90 | __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
|
---|
91 | ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
|
---|
92 | __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
|
---|
93 | .eh_frame BLOCK(__section_alignment__) :
|
---|
94 | {
|
---|
95 | KEEP(*(.eh_frame*))
|
---|
96 | }
|
---|
97 | .pdata BLOCK(__section_alignment__) :
|
---|
98 | {
|
---|
99 | KEEP(*(.pdata*))
|
---|
100 | }
|
---|
101 | .bss BLOCK(__section_alignment__) :
|
---|
102 | {
|
---|
103 | __bss_start__ = . ;
|
---|
104 | *(.bss)
|
---|
105 | *(COMMON)
|
---|
106 | __bss_end__ = . ;
|
---|
107 | }
|
---|
108 | .edata BLOCK(__section_alignment__) :
|
---|
109 | {
|
---|
110 | *(.edata)
|
---|
111 | }
|
---|
112 | /DISCARD/ :
|
---|
113 | {
|
---|
114 | *(.debug$S)
|
---|
115 | *(.debug$T)
|
---|
116 | *(.debug$F)
|
---|
117 | *(.drectve)
|
---|
118 | *(.note.GNU-stack)
|
---|
119 | *(.gnu.lto_*)
|
---|
120 | }
|
---|
121 | .idata BLOCK(__section_alignment__) :
|
---|
122 | {
|
---|
123 | /* This cannot currently be handled with grouped sections.
|
---|
124 | See pe.em:sort_sections. */
|
---|
125 | KEEP (SORT(*)(.idata$2))
|
---|
126 | KEEP (SORT(*)(.idata$3))
|
---|
127 | /* These zeroes mark the end of the import list. */
|
---|
128 | LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
|
---|
129 | KEEP (SORT(*)(.idata$4))
|
---|
130 | __IAT_start__ = .;
|
---|
131 | KEEP (SORT(*)(.idata$5))
|
---|
132 | __IAT_end__ = .;
|
---|
133 | KEEP (SORT(*)(.idata$6))
|
---|
134 | KEEP (SORT(*)(.idata$7))
|
---|
135 | }
|
---|
136 | .CRT BLOCK(__section_alignment__) :
|
---|
137 | {
|
---|
138 | ___crt_xc_start__ = . ;
|
---|
139 | KEEP (*(SORT(.CRT$XC*))) /* C initialization */
|
---|
140 | ___crt_xc_end__ = . ;
|
---|
141 | ___crt_xi_start__ = . ;
|
---|
142 | KEEP (*(SORT(.CRT$XI*))) /* C++ initialization */
|
---|
143 | ___crt_xi_end__ = . ;
|
---|
144 | ___crt_xl_start__ = . ;
|
---|
145 | KEEP (*(SORT(.CRT$XL*))) /* TLS callbacks */
|
---|
146 | /* ___crt_xl_end__ is defined in the TLS Directory support code */
|
---|
147 | ___crt_xp_start__ = . ;
|
---|
148 | KEEP (*(SORT(.CRT$XP*))) /* Pre-termination */
|
---|
149 | ___crt_xp_end__ = . ;
|
---|
150 | ___crt_xt_start__ = . ;
|
---|
151 | KEEP (*(SORT(.CRT$XT*))) /* Termination */
|
---|
152 | ___crt_xt_end__ = . ;
|
---|
153 | }
|
---|
154 | /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be
|
---|
155 | at the end of section. This is important because _tls_start MUST
|
---|
156 | be at the beginning of the section to enable SECREL32 relocations with TLS
|
---|
157 | data. */
|
---|
158 | .tls BLOCK(__section_alignment__) :
|
---|
159 | {
|
---|
160 | ___tls_start__ = . ;
|
---|
161 | KEEP (*(.tls$AAA))
|
---|
162 | KEEP (*(.tls))
|
---|
163 | KEEP (*(.tls$))
|
---|
164 | KEEP (*(SORT(.tls$*)))
|
---|
165 | KEEP (*(.tls$ZZZ))
|
---|
166 | ___tls_end__ = . ;
|
---|
167 | }
|
---|
168 | .endjunk BLOCK(__section_alignment__) :
|
---|
169 | {
|
---|
170 | /* end is deprecated, don't use it */
|
---|
171 | PROVIDE (end = .);
|
---|
172 | PROVIDE ( _end = .);
|
---|
173 | __end__ = .;
|
---|
174 | }
|
---|
175 | .rsrc BLOCK(__section_alignment__) : SUBALIGN(4)
|
---|
176 | {
|
---|
177 | KEEP (*(.rsrc))
|
---|
178 | KEEP (*(.rsrc$*))
|
---|
179 | }
|
---|
180 | .reloc BLOCK(__section_alignment__) :
|
---|
181 | {
|
---|
182 | *(.reloc)
|
---|
183 | }
|
---|
184 | .stab BLOCK(__section_alignment__) (NOLOAD) :
|
---|
185 | {
|
---|
186 | *(.stab)
|
---|
187 | }
|
---|
188 | .stabstr BLOCK(__section_alignment__) (NOLOAD) :
|
---|
189 | {
|
---|
190 | *(.stabstr)
|
---|
191 | }
|
---|
192 | /* DWARF debug sections.
|
---|
193 | Symbols in the DWARF debugging sections are relative to the beginning
|
---|
194 | of the section. Unlike other targets that fake this by putting the
|
---|
195 | section VMA at 0, the PE format will not allow it. */
|
---|
196 | /* DWARF 1.1 and DWARF 2. */
|
---|
197 | .debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
|
---|
198 | {
|
---|
199 | *(.debug_aranges)
|
---|
200 | }
|
---|
201 | .zdebug_aranges BLOCK(__section_alignment__) (NOLOAD) :
|
---|
202 | {
|
---|
203 | *(.zdebug_aranges)
|
---|
204 | }
|
---|
205 | .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
206 | {
|
---|
207 | *(.debug_pubnames)
|
---|
208 | }
|
---|
209 | .zdebug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
210 | {
|
---|
211 | *(.zdebug_pubnames)
|
---|
212 | }
|
---|
213 | /* DWARF 2. */
|
---|
214 | .debug_info BLOCK(__section_alignment__) (NOLOAD) :
|
---|
215 | {
|
---|
216 | *(.debug_info .gnu.linkonce.wi.*)
|
---|
217 | }
|
---|
218 | .zdebug_info BLOCK(__section_alignment__) (NOLOAD) :
|
---|
219 | {
|
---|
220 | *(.zdebug_info .zdebug.gnu.linkonce.wi.*)
|
---|
221 | }
|
---|
222 | .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
|
---|
223 | {
|
---|
224 | *(.debug_abbrev)
|
---|
225 | }
|
---|
226 | .zdebug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
|
---|
227 | {
|
---|
228 | *(.zdebug_abbrev)
|
---|
229 | }
|
---|
230 | .debug_line BLOCK(__section_alignment__) (NOLOAD) :
|
---|
231 | {
|
---|
232 | *(.debug_line)
|
---|
233 | }
|
---|
234 | .zdebug_line BLOCK(__section_alignment__) (NOLOAD) :
|
---|
235 | {
|
---|
236 | *(.zdebug_line)
|
---|
237 | }
|
---|
238 | .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
|
---|
239 | {
|
---|
240 | *(.debug_frame*)
|
---|
241 | }
|
---|
242 | .zdebug_frame BLOCK(__section_alignment__) (NOLOAD) :
|
---|
243 | {
|
---|
244 | *(.zdebug_frame*)
|
---|
245 | }
|
---|
246 | .debug_str BLOCK(__section_alignment__) (NOLOAD) :
|
---|
247 | {
|
---|
248 | *(.debug_str)
|
---|
249 | }
|
---|
250 | .zdebug_str BLOCK(__section_alignment__) (NOLOAD) :
|
---|
251 | {
|
---|
252 | *(.zdebug_str)
|
---|
253 | }
|
---|
254 | .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
|
---|
255 | {
|
---|
256 | *(.debug_loc)
|
---|
257 | }
|
---|
258 | .zdebug_loc BLOCK(__section_alignment__) (NOLOAD) :
|
---|
259 | {
|
---|
260 | *(.zdebug_loc)
|
---|
261 | }
|
---|
262 | .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
|
---|
263 | {
|
---|
264 | *(.debug_macinfo)
|
---|
265 | }
|
---|
266 | .zdebug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
|
---|
267 | {
|
---|
268 | *(.zdebug_macinfo)
|
---|
269 | }
|
---|
270 | /* SGI/MIPS DWARF 2 extensions. */
|
---|
271 | .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
272 | {
|
---|
273 | *(.debug_weaknames)
|
---|
274 | }
|
---|
275 | .zdebug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
276 | {
|
---|
277 | *(.zdebug_weaknames)
|
---|
278 | }
|
---|
279 | .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
280 | {
|
---|
281 | *(.debug_funcnames)
|
---|
282 | }
|
---|
283 | .zdebug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
284 | {
|
---|
285 | *(.zdebug_funcnames)
|
---|
286 | }
|
---|
287 | .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
288 | {
|
---|
289 | *(.debug_typenames)
|
---|
290 | }
|
---|
291 | .zdebug_typenames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
292 | {
|
---|
293 | *(.zdebug_typenames)
|
---|
294 | }
|
---|
295 | .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
296 | {
|
---|
297 | *(.debug_varnames)
|
---|
298 | }
|
---|
299 | .zdebug_varnames BLOCK(__section_alignment__) (NOLOAD) :
|
---|
300 | {
|
---|
301 | *(.zdebug_varnames)
|
---|
302 | }
|
---|
303 | /* DWARF 3. */
|
---|
304 | .debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
|
---|
305 | {
|
---|
306 | *(.debug_pubtypes)
|
---|
307 | }
|
---|
308 | .zdebug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
|
---|
309 | {
|
---|
310 | *(.zdebug_pubtypes)
|
---|
311 | }
|
---|
312 | .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
|
---|
313 | {
|
---|
314 | *(.debug_ranges)
|
---|
315 | }
|
---|
316 | .zdebug_ranges BLOCK(__section_alignment__) (NOLOAD) :
|
---|
317 | {
|
---|
318 | *(.zdebug_ranges)
|
---|
319 | }
|
---|
320 | /* DWARF 4. */
|
---|
321 | .debug_types BLOCK(__section_alignment__) (NOLOAD) :
|
---|
322 | {
|
---|
323 | *(.debug_types .gnu.linkonce.wt.*)
|
---|
324 | }
|
---|
325 | .zdebug_types BLOCK(__section_alignment__) (NOLOAD) :
|
---|
326 | {
|
---|
327 | *(.zdebug_types .gnu.linkonce.wt.*)
|
---|
328 | }
|
---|
329 | /* DWARF 5. */
|
---|
330 | .debug_addr BLOCK(__section_alignment__) (NOLOAD) :
|
---|
331 | {
|
---|
332 | *(.debug_addr)
|
---|
333 | }
|
---|
334 | .zdebug_addr BLOCK(__section_alignment__) (NOLOAD) :
|
---|
335 | {
|
---|
336 | *(.zdebug_addr)
|
---|
337 | }
|
---|
338 | .debug_line_str BLOCK(__section_alignment__) (NOLOAD) :
|
---|
339 | {
|
---|
340 | *(.debug_line_str)
|
---|
341 | }
|
---|
342 | .zdebug_line_str BLOCK(__section_alignment__) (NOLOAD) :
|
---|
343 | {
|
---|
344 | *(.zdebug_line_str)
|
---|
345 | }
|
---|
346 | .debug_loclists BLOCK(__section_alignment__) (NOLOAD) :
|
---|
347 | {
|
---|
348 | *(.debug_loclists)
|
---|
349 | }
|
---|
350 | .zdebug_loclists BLOCK(__section_alignment__) (NOLOAD) :
|
---|
351 | {
|
---|
352 | *(.zdebug_loclists)
|
---|
353 | }
|
---|
354 | .debug_macro BLOCK(__section_alignment__) (NOLOAD) :
|
---|
355 | {
|
---|
356 | *(.debug_macro)
|
---|
357 | }
|
---|
358 | .zdebug_macro BLOCK(__section_alignment__) (NOLOAD) :
|
---|
359 | {
|
---|
360 | *(.zdebug_macro)
|
---|
361 | }
|
---|
362 | .debug_names BLOCK(__section_alignment__) (NOLOAD) :
|
---|
363 | {
|
---|
364 | *(.debug_names)
|
---|
365 | }
|
---|
366 | .zdebug_names BLOCK(__section_alignment__) (NOLOAD) :
|
---|
367 | {
|
---|
368 | *(.zdebug_names)
|
---|
369 | }
|
---|
370 | .debug_rnglists BLOCK(__section_alignment__) (NOLOAD) :
|
---|
371 | {
|
---|
372 | *(.debug_rnglists)
|
---|
373 | }
|
---|
374 | .zdebug_rnglists BLOCK(__section_alignment__) (NOLOAD) :
|
---|
375 | {
|
---|
376 | *(.zdebug_rnglists)
|
---|
377 | }
|
---|
378 | .debug_str_offsets BLOCK(__section_alignment__) (NOLOAD) :
|
---|
379 | {
|
---|
380 | *(.debug_str_offsets)
|
---|
381 | }
|
---|
382 | .zdebug_str_offsets BLOCK(__section_alignment__) (NOLOAD) :
|
---|
383 | {
|
---|
384 | *(.zdebug_str_offsets)
|
---|
385 | }
|
---|
386 | .debug_sup BLOCK(__section_alignment__) (NOLOAD) :
|
---|
387 | {
|
---|
388 | *(.debug_sup)
|
---|
389 | }
|
---|
390 | /* For Go and Rust. */
|
---|
391 | .debug_gdb_scripts BLOCK(__section_alignment__) (NOLOAD) :
|
---|
392 | {
|
---|
393 | *(.debug_gdb_scripts)
|
---|
394 | }
|
---|
395 | .zdebug_gdb_scripts BLOCK(__section_alignment__) (NOLOAD) :
|
---|
396 | {
|
---|
397 | *(.zdebug_gdb_scripts)
|
---|
398 | }
|
---|
399 | }
|
---|