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