1 | /* Script for -Ur */
|
---|
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(pe-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 | .text :
|
---|
11 | {
|
---|
12 | *(.text)
|
---|
13 | /* Note: we always define __CTOR_LIST__ and ___CTOR_LIST__ here,
|
---|
14 | we do not PROVIDE them. This is because the ctors.o startup
|
---|
15 | code in libgcc defines them as common symbols, with the
|
---|
16 | expectation that they will be overridden by the definitions
|
---|
17 | here. If we PROVIDE the symbols then they will not be
|
---|
18 | overridden and global constructors will not be run.
|
---|
19 | See PR 22762 for more details.
|
---|
20 |
|
---|
21 | This does mean that it is not possible for a user to define
|
---|
22 | their own __CTOR_LIST__ and __DTOR_LIST__ symbols; if they do,
|
---|
23 | the content from those variables are included but the symbols
|
---|
24 | defined here silently take precedence. If they truly need to
|
---|
25 | be redefined, a custom linker script will have to be used.
|
---|
26 | (The custom script can just be a copy of this script with the
|
---|
27 | PROVIDE() qualifiers added).
|
---|
28 | In particular this means that ld -Ur does not work, because
|
---|
29 | the proper __CTOR_LIST__ set by ld -Ur is overridden by a
|
---|
30 | bogus __CTOR_LIST__ set by the final link. See PR 46. */
|
---|
31 | ___CTOR_LIST__ = .;
|
---|
32 | __CTOR_LIST__ = .;
|
---|
33 | LONG (-1);
|
---|
34 | KEEP(*(.ctors));
|
---|
35 | KEEP(*(.ctor));
|
---|
36 | KEEP(*(SORT_BY_NAME(.ctors.*)));
|
---|
37 | LONG (0);
|
---|
38 | /* See comment about __CTOR_LIST__ above. The same reasoning
|
---|
39 | applies here too. */
|
---|
40 | ___DTOR_LIST__ = .;
|
---|
41 | __DTOR_LIST__ = .;
|
---|
42 | LONG (-1);
|
---|
43 | KEEP(*(.dtors));
|
---|
44 | KEEP(*(.dtor));
|
---|
45 | KEEP(*(SORT_BY_NAME(.dtors.*)));
|
---|
46 | LONG (0);
|
---|
47 | }
|
---|
48 | /* The Cygwin32 library uses a section to avoid copying certain data
|
---|
49 | on fork. This used to be named ".data". The linker used
|
---|
50 | to include this between __data_start__ and __data_end__, but that
|
---|
51 | breaks building the cygwin32 dll. Instead, we name the section
|
---|
52 | ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
|
---|
53 | .data :
|
---|
54 | {
|
---|
55 | *(.data)
|
---|
56 | KEEP(*(.jcr))
|
---|
57 | }
|
---|
58 | .rdata :
|
---|
59 | {
|
---|
60 | *(.rdata)
|
---|
61 | . = ALIGN(4);
|
---|
62 | }
|
---|
63 | .eh_frame :
|
---|
64 | {
|
---|
65 | KEEP(*(.eh_frame))
|
---|
66 | }
|
---|
67 | .pdata :
|
---|
68 | {
|
---|
69 | KEEP(*(.pdata))
|
---|
70 | }
|
---|
71 | .bss :
|
---|
72 | {
|
---|
73 | *(.bss)
|
---|
74 | *(COMMON)
|
---|
75 | }
|
---|
76 | .edata :
|
---|
77 | {
|
---|
78 | *(.edata)
|
---|
79 | }
|
---|
80 | /DISCARD/ :
|
---|
81 | {
|
---|
82 | *(.debug$S)
|
---|
83 | *(.debug$T)
|
---|
84 | *(.debug$F)
|
---|
85 | *(.drectve)
|
---|
86 | }
|
---|
87 | .idata :
|
---|
88 | {
|
---|
89 | /* This cannot currently be handled with grouped sections.
|
---|
90 | See pe.em:sort_sections. */
|
---|
91 | }
|
---|
92 | .CRT :
|
---|
93 | {
|
---|
94 | /* ___crt_xl_end__ is defined in the TLS Directory support code */
|
---|
95 | }
|
---|
96 | /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be
|
---|
97 | at the end of section. This is important because _tls_start MUST
|
---|
98 | be at the beginning of the section to enable SECREL32 relocations with TLS
|
---|
99 | data. */
|
---|
100 | .tls :
|
---|
101 | {
|
---|
102 | *(.tls)
|
---|
103 | }
|
---|
104 | .endjunk :
|
---|
105 | {
|
---|
106 | /* end is deprecated, don't use it */
|
---|
107 | }
|
---|
108 | .rsrc : SUBALIGN(4)
|
---|
109 | {
|
---|
110 | *(.rsrc)
|
---|
111 | }
|
---|
112 | .reloc :
|
---|
113 | {
|
---|
114 | *(.reloc)
|
---|
115 | }
|
---|
116 | .stab :
|
---|
117 | {
|
---|
118 | *(.stab)
|
---|
119 | }
|
---|
120 | .stabstr :
|
---|
121 | {
|
---|
122 | *(.stabstr)
|
---|
123 | }
|
---|
124 | /* DWARF debug sections.
|
---|
125 | Symbols in the DWARF debugging sections are relative to the beginning
|
---|
126 | of the section. Unlike other targets that fake this by putting the
|
---|
127 | section VMA at 0, the PE format will not allow it. */
|
---|
128 | /* DWARF 1.1 and DWARF 2. */
|
---|
129 | .debug_aranges :
|
---|
130 | {
|
---|
131 | *(.debug_aranges)
|
---|
132 | }
|
---|
133 | .zdebug_aranges :
|
---|
134 | {
|
---|
135 | *(.zdebug_aranges)
|
---|
136 | }
|
---|
137 | .debug_pubnames :
|
---|
138 | {
|
---|
139 | *(.debug_pubnames)
|
---|
140 | }
|
---|
141 | .zdebug_pubnames :
|
---|
142 | {
|
---|
143 | *(.zdebug_pubnames)
|
---|
144 | }
|
---|
145 | /* DWARF 2. */
|
---|
146 | .debug_info :
|
---|
147 | {
|
---|
148 | *(.debug_info)
|
---|
149 | }
|
---|
150 | .zdebug_info :
|
---|
151 | {
|
---|
152 | *(.zdebug_info)
|
---|
153 | }
|
---|
154 | .debug_abbrev :
|
---|
155 | {
|
---|
156 | *(.debug_abbrev)
|
---|
157 | }
|
---|
158 | .zdebug_abbrev :
|
---|
159 | {
|
---|
160 | *(.zdebug_abbrev)
|
---|
161 | }
|
---|
162 | .debug_line :
|
---|
163 | {
|
---|
164 | *(.debug_line)
|
---|
165 | }
|
---|
166 | .zdebug_line :
|
---|
167 | {
|
---|
168 | *(.zdebug_line)
|
---|
169 | }
|
---|
170 | .debug_frame :
|
---|
171 | {
|
---|
172 | *(.debug_frame*)
|
---|
173 | }
|
---|
174 | .zdebug_frame :
|
---|
175 | {
|
---|
176 | *(.zdebug_frame*)
|
---|
177 | }
|
---|
178 | .debug_str :
|
---|
179 | {
|
---|
180 | *(.debug_str)
|
---|
181 | }
|
---|
182 | .zdebug_str :
|
---|
183 | {
|
---|
184 | *(.zdebug_str)
|
---|
185 | }
|
---|
186 | .debug_loc :
|
---|
187 | {
|
---|
188 | *(.debug_loc)
|
---|
189 | }
|
---|
190 | .zdebug_loc :
|
---|
191 | {
|
---|
192 | *(.zdebug_loc)
|
---|
193 | }
|
---|
194 | .debug_macinfo :
|
---|
195 | {
|
---|
196 | *(.debug_macinfo)
|
---|
197 | }
|
---|
198 | .zdebug_macinfo :
|
---|
199 | {
|
---|
200 | *(.zdebug_macinfo)
|
---|
201 | }
|
---|
202 | /* SGI/MIPS DWARF 2 extensions. */
|
---|
203 | .debug_weaknames :
|
---|
204 | {
|
---|
205 | *(.debug_weaknames)
|
---|
206 | }
|
---|
207 | .zdebug_weaknames :
|
---|
208 | {
|
---|
209 | *(.zdebug_weaknames)
|
---|
210 | }
|
---|
211 | .debug_funcnames :
|
---|
212 | {
|
---|
213 | *(.debug_funcnames)
|
---|
214 | }
|
---|
215 | .zdebug_funcnames :
|
---|
216 | {
|
---|
217 | *(.zdebug_funcnames)
|
---|
218 | }
|
---|
219 | .debug_typenames :
|
---|
220 | {
|
---|
221 | *(.debug_typenames)
|
---|
222 | }
|
---|
223 | .zdebug_typenames :
|
---|
224 | {
|
---|
225 | *(.zdebug_typenames)
|
---|
226 | }
|
---|
227 | .debug_varnames :
|
---|
228 | {
|
---|
229 | *(.debug_varnames)
|
---|
230 | }
|
---|
231 | .zdebug_varnames :
|
---|
232 | {
|
---|
233 | *(.zdebug_varnames)
|
---|
234 | }
|
---|
235 | /* DWARF 3. */
|
---|
236 | .debug_pubtypes :
|
---|
237 | {
|
---|
238 | *(.debug_pubtypes)
|
---|
239 | }
|
---|
240 | .zdebug_pubtypes :
|
---|
241 | {
|
---|
242 | *(.zdebug_pubtypes)
|
---|
243 | }
|
---|
244 | .debug_ranges :
|
---|
245 | {
|
---|
246 | *(.debug_ranges)
|
---|
247 | }
|
---|
248 | .zdebug_ranges :
|
---|
249 | {
|
---|
250 | *(.zdebug_ranges)
|
---|
251 | }
|
---|
252 | /* DWARF 4. */
|
---|
253 | .debug_types :
|
---|
254 | {
|
---|
255 | *(.debug_types)
|
---|
256 | }
|
---|
257 | .zdebug_types :
|
---|
258 | {
|
---|
259 | *(.zdebug_types)
|
---|
260 | }
|
---|
261 | /* DWARF 5. */
|
---|
262 | .debug_addr :
|
---|
263 | {
|
---|
264 | *(.debug_addr)
|
---|
265 | }
|
---|
266 | .zdebug_addr :
|
---|
267 | {
|
---|
268 | *(.zdebug_addr)
|
---|
269 | }
|
---|
270 | .debug_line_str :
|
---|
271 | {
|
---|
272 | *(.debug_line_str)
|
---|
273 | }
|
---|
274 | .zdebug_line_str :
|
---|
275 | {
|
---|
276 | *(.zdebug_line_str)
|
---|
277 | }
|
---|
278 | .debug_loclists :
|
---|
279 | {
|
---|
280 | *(.debug_loclists)
|
---|
281 | }
|
---|
282 | .zdebug_loclists :
|
---|
283 | {
|
---|
284 | *(.zdebug_loclists)
|
---|
285 | }
|
---|
286 | .debug_macro :
|
---|
287 | {
|
---|
288 | *(.debug_macro)
|
---|
289 | }
|
---|
290 | .zdebug_macro :
|
---|
291 | {
|
---|
292 | *(.zdebug_macro)
|
---|
293 | }
|
---|
294 | .debug_names :
|
---|
295 | {
|
---|
296 | *(.debug_names)
|
---|
297 | }
|
---|
298 | .zdebug_names :
|
---|
299 | {
|
---|
300 | *(.zdebug_names)
|
---|
301 | }
|
---|
302 | .debug_rnglists :
|
---|
303 | {
|
---|
304 | *(.debug_rnglists)
|
---|
305 | }
|
---|
306 | .zdebug_rnglists :
|
---|
307 | {
|
---|
308 | *(.zdebug_rnglists)
|
---|
309 | }
|
---|
310 | .debug_str_offsets :
|
---|
311 | {
|
---|
312 | *(.debug_str_offsets)
|
---|
313 | }
|
---|
314 | .zdebug_str_offsets :
|
---|
315 | {
|
---|
316 | *(.zdebug_str_offsets)
|
---|
317 | }
|
---|
318 | .debug_sup :
|
---|
319 | {
|
---|
320 | *(.debug_sup)
|
---|
321 | }
|
---|
322 | /* For Go and Rust. */
|
---|
323 | .debug_gdb_scripts :
|
---|
324 | {
|
---|
325 | *(.debug_gdb_scripts)
|
---|
326 | }
|
---|
327 | .zdebug_gdb_scripts :
|
---|
328 | {
|
---|
329 | *(.zdebug_gdb_scripts)
|
---|
330 | }
|
---|
331 | }
|
---|