Remove arm-epoc-pe support
[deliverable/binutils-gdb.git] / ld / scripttempl / pep.sc
CommitLineData
99ad8390 1# Linker script for PE.
985743c7 2#
219d1afa 3# Copyright (C) 2014-2018 Free Software Foundation, Inc.
6c19b93b 4#
985743c7
NC
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.
99ad8390
NC
8
9if test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then
10 RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
11fi
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).
20if test "${RELOCATING}"; then
21 R_TEXT='*(SORT(.text$*))'
e2a83dd0
NC
22 if test "x$LD_FLAG" = "xauto_import" ; then
23 R_DATA='*(SORT(.data$*))
6c19b93b 24 *(.rdata)
e2a83dd0
NC
25 *(SORT(.rdata$*))'
26 R_RDATA=''
27 else
28 R_DATA='*(SORT(.data$*))'
29 R_RDATA='*(.rdata)
6c19b93b 30 *(SORT(.rdata$*))'
e2a83dd0 31 fi
d4874973 32 R_IDATA234='
0f088b2a
KT
33 KEEP (SORT(*)(.idata$2))
34 KEEP (SORT(*)(.idata$3))
99ad8390
NC
35 /* These zeroes mark the end of the import list. */
36 LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
0f088b2a 37 KEEP (SORT(*)(.idata$4))'
d4874973
KT
38 R_IDATA5='SORT(*)(.idata$5)'
39 R_IDATA67='
0f088b2a
KT
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 */'
99ad8390 47 R_TLS='
0f088b2a
KT
48 KEEP (*(.tls$AAA))
49 KEEP (*(.tls))
50 KEEP (*(.tls$))
51 KEEP (*(SORT(.tls$*)))
52 KEEP (*(.tls$ZZZ))'
6c1799ad 53 R_RSRC='
0f088b2a
KT
54 KEEP (*(.rsrc))
55 KEEP (*(.rsrc$*))'
99ad8390
NC
56else
57 R_TEXT=
58 R_DATA=
e2a83dd0 59 R_RDATA='*(.rdata)'
d4874973
KT
60 R_IDATA234=
61 R_IDATA5=
62 R_IDATA67=
c48cfedd
AM
63 R_CRT_XC=
64 R_CRT_XI=
65 R_CRT_XL=
66 R_CRT_XP=
67 R_CRT_XT=
68 R_TLS='*(.tls)'
5063daf7 69 R_RSRC='*(.rsrc)'
99ad8390
NC
70fi
71
72cat <<EOF
219d1afa 73/* Copyright (C) 2014-2018 Free Software Foundation, Inc.
985743c7
NC
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
99ad8390
NC
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
85SECTIONS
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__);}
5063daf7 91 .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
99ad8390 92 {
0f088b2a 93 ${RELOCATING+ KEEP(*(.init))}
99ad8390
NC
94 *(.text)
95 ${R_TEXT}
032f3e01 96 ${RELOCATING+ *(.text.*)}
ebe9c501 97 ${RELOCATING+ *(.gnu.linkonce.t.*)}
c48cfedd
AM
98 ${RELOCATING+*(.glue_7t)}
99 ${RELOCATING+*(.glue_7)}
da6fa31a 100 ${CONSTRUCTING+. = ALIGN(8);}
ca6f2be7 101 ${CONSTRUCTING+
b0daac83
NC
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 that
111 ability is needed a custom linker script will have to be
112 used. (The custom script can just be a copy of this script
113 with the PROVIDE() qualifiers added).
114
115 See PR 22762 for more details. */
116 ___CTOR_LIST__ = .;
117 __CTOR_LIST__ = .;
ca6f2be7
NC
118 LONG (-1); LONG (-1);
119 KEEP (*(.ctors));
120 KEEP (*(.ctor));
121 KEEP (*(SORT_BY_NAME(.ctors.*)));
122 LONG (0); LONG (0);
123 }
124 ${CONSTRUCTING+
b0daac83
NC
125 /* See comment about __CTOR_LIST__ above. The same reasoning
126 applies here too. */
127 ___DTOR_LIST__ = .;
128 __DTOR_LIST__ = .;
ca6f2be7
NC
129 LONG (-1); LONG (-1);
130 KEEP (*(.dtors));
131 KEEP (*(.dtor));
132 KEEP (*(SORT_BY_NAME(.dtors.*)));
133 LONG (0); LONG (0);
134 }
0f088b2a 135 ${RELOCATING+ KEEP (*(.fini))}
99ad8390
NC
136 /* ??? Why is .gcc_exc here? */
137 ${RELOCATING+ *(.gcc_exc)}
138 ${RELOCATING+PROVIDE (etext = .);}
0f088b2a 139 ${RELOCATING+ KEEP (*(.gcc_except_table))}
99ad8390
NC
140 }
141
142 /* The Cygwin32 library uses a section to avoid copying certain data
143 on fork. This used to be named ".data$nocopy". The linker used
144 to include this between __data_start__ and __data_end__, but that
145 breaks building the cygwin32 dll. Instead, we name the section
cc643b88 146 ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
99ad8390 147
5063daf7 148 .data ${RELOCATING+BLOCK(__section_alignment__)} :
99ad8390
NC
149 {
150 ${RELOCATING+__data_start__ = . ;}
151 *(.data)
c48cfedd 152 ${RELOCATING+*(.data2)}
99ad8390 153 ${R_DATA}
0f088b2a 154 KEEP(*(.jcr))
99ad8390
NC
155 ${RELOCATING+__data_end__ = . ;}
156 ${RELOCATING+*(.data_cygwin_nocopy)}
157 }
158
159 .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
160 {
99ad8390 161 ${R_RDATA}
730035f7 162 ${RELOCATING+__rt_psrelocs_start = .;}
c48cfedd 163 ${RELOCATING+KEEP(*(.rdata_runtime_pseudo_reloc))}
730035f7 164 ${RELOCATING+__rt_psrelocs_end = .;}
99ad8390 165 }
730035f7
DK
166 ${RELOCATING+__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;}
167 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
168 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
169 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
170 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
99ad8390 171
27505b5d
TG
172 .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
173 {
c48cfedd 174 KEEP (*(.eh_frame${RELOCATING+*}))
27505b5d
TG
175 }
176
99ad8390
NC
177 .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
178 {
c48cfedd 179 KEEP(*(.pdata${RELOCATING+*}))
2d7f4929
KT
180 }
181
182 .xdata ${RELOCATING+BLOCK(__section_alignment__)} :
183 {
c48cfedd 184 KEEP(*(.xdata${RELOCATING+*}))
99ad8390
NC
185 }
186
187 .bss ${RELOCATING+BLOCK(__section_alignment__)} :
188 {
189 ${RELOCATING+__bss_start__ = . ;}
190 *(.bss)
191 *(COMMON)
192 ${RELOCATING+__bss_end__ = . ;}
193 }
194
195 .edata ${RELOCATING+BLOCK(__section_alignment__)} :
196 {
197 *(.edata)
198 }
199
200 /DISCARD/ :
201 {
202 *(.debug\$S)
203 *(.debug\$T)
204 *(.debug\$F)
205 *(.drectve)
fecc36fd
KT
206 ${RELOCATING+ *(.note.GNU-stack)}
207 ${RELOCATING+ *(.gnu.lto_*)}
99ad8390
NC
208 }
209
210 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
211 {
212 /* This cannot currently be handled with grouped sections.
213 See pep.em:sort_sections. */
d4874973
KT
214 ${R_IDATA234}
215 ${RELOCATING+__IAT_start__ = .;}
216 ${R_IDATA5}
217 ${RELOCATING+__IAT_end__ = .;}
218 ${R_IDATA67}
99ad8390
NC
219 }
220 .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
6c19b93b 221 {
99ad8390
NC
222 ${RELOCATING+___crt_xc_start__ = . ;}
223 ${R_CRT_XC}
224 ${RELOCATING+___crt_xc_end__ = . ;}
225 ${RELOCATING+___crt_xi_start__ = . ;}
226 ${R_CRT_XI}
227 ${RELOCATING+___crt_xi_end__ = . ;}
228 ${RELOCATING+___crt_xl_start__ = . ;}
229 ${R_CRT_XL}
230 /* ___crt_xl_end__ is defined in the TLS Directory support code */
231 ${RELOCATING+___crt_xp_start__ = . ;}
232 ${R_CRT_XP}
233 ${RELOCATING+___crt_xp_end__ = . ;}
234 ${RELOCATING+___crt_xt_start__ = . ;}
235 ${R_CRT_XT}
236 ${RELOCATING+___crt_xt_end__ = . ;}
237 }
238
a988325c
NC
239 /* Windows TLS expects .tls\$AAA to be at the start and .tls\$ZZZ to be
240 at the end of the .tls section. This is important because _tls_start MUST
241 be at the beginning of the section to enable SECREL32 relocations with TLS
242 data. */
99ad8390 243 .tls ${RELOCATING+BLOCK(__section_alignment__)} :
6c19b93b 244 {
99ad8390
NC
245 ${RELOCATING+___tls_start__ = . ;}
246 ${R_TLS}
247 ${RELOCATING+___tls_end__ = . ;}
248 }
249
250 .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
251 {
252 /* end is deprecated, don't use it */
253 ${RELOCATING+PROVIDE (end = .);}
254 ${RELOCATING+PROVIDE ( _end = .);}
255 ${RELOCATING+ __end__ = .;}
256 }
257
1d63324c 258 .rsrc ${RELOCATING+BLOCK(__section_alignment__)} : SUBALIGN(4)
5063daf7 259 {
99ad8390
NC
260 ${R_RSRC}
261 }
262
263 .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
5063daf7 264 {
99ad8390
NC
265 *(.reloc)
266 }
267
268 .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
269 {
270 *(.stab)
271 }
272
273 .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
274 {
275 *(.stabstr)
276 }
277
278 /* DWARF debug sections.
279 Symbols in the DWARF debugging sections are relative to the beginning
280 of the section. Unlike other targets that fake this by putting the
281 section VMA at 0, the PE format will not allow it. */
5063daf7 282
99ad8390
NC
283 /* DWARF 1.1 and DWARF 2. */
284 .debug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
285 {
286 *(.debug_aranges)
287 }
a29a8af8
KT
288 .zdebug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
289 {
290 *(.zdebug_aranges)
291 }
99ad8390
NC
292
293 .debug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
294 {
295 *(.debug_pubnames)
296 }
a29a8af8
KT
297 .zdebug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
298 {
299 *(.zdebug_pubnames)
300 }
99ad8390 301
22418005 302 .debug_pubtypes ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
a626fe20
KT
303 {
304 *(.debug_pubtypes)
305 }
a29a8af8
KT
306 .zdebug_pubtypes ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
307 {
308 *(.zdebug_pubtypes)
309 }
a626fe20 310
99ad8390
NC
311 /* DWARF 2. */
312 .debug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
313 {
ebe9c501 314 *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*})
99ad8390 315 }
a29a8af8
KT
316 .zdebug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
317 {
318 *(.zdebug_info${RELOCATING+ .zdebug.gnu.linkonce.wi.*})
319 }
99ad8390
NC
320
321 .debug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
322 {
323 *(.debug_abbrev)
324 }
a29a8af8
KT
325 .zdebug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
326 {
327 *(.zdebug_abbrev)
328 }
99ad8390
NC
329
330 .debug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
331 {
332 *(.debug_line)
333 }
a29a8af8
KT
334 .zdebug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
335 {
336 *(.zdebug_line)
337 }
99ad8390
NC
338
339 .debug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
340 {
f5c66ab0 341 *(.debug_frame)
99ad8390 342 }
a29a8af8
KT
343 .zdebug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
344 {
f5c66ab0 345 *(.zdebug_frame)
a29a8af8 346 }
99ad8390
NC
347
348 .debug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
349 {
350 *(.debug_str)
351 }
a29a8af8
KT
352 .zdebug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
353 {
354 *(.zdebug_str)
355 }
99ad8390
NC
356
357 .debug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
358 {
359 *(.debug_loc)
360 }
a29a8af8
KT
361 .zdebug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
362 {
363 *(.zdebug_loc)
364 }
99ad8390
NC
365
366 .debug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
367 {
368 *(.debug_macinfo)
369 }
a29a8af8
KT
370 .zdebug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
371 {
372 *(.zdebug_macinfo)
373 }
99ad8390
NC
374
375 /* SGI/MIPS DWARF 2 extensions. */
376 .debug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
377 {
378 *(.debug_weaknames)
379 }
a29a8af8
KT
380 .zdebug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
381 {
382 *(.zdebug_weaknames)
383 }
99ad8390
NC
384
385 .debug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
386 {
387 *(.debug_funcnames)
388 }
a29a8af8
KT
389 .zdebug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
390 {
391 *(.zdebug_funcnames)
392 }
99ad8390
NC
393
394 .debug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
395 {
396 *(.debug_typenames)
397 }
a29a8af8
KT
398 .zdebug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
399 {
400 *(.zdebug_typenames)
401 }
99ad8390
NC
402
403 .debug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
404 {
405 *(.debug_varnames)
406 }
a29a8af8
KT
407 .zdebug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
408 {
409 *(.zdebug_varnames)
410 }
99ad8390 411
b990ad61
KT
412 .debug_macro ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
413 {
414 *(.debug_macro)
415 }
a29a8af8
KT
416 .zdebug_macro ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
417 {
418 *(.zdebug_macro)
419 }
b990ad61 420
99ad8390
NC
421 /* DWARF 3. */
422 .debug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
423 {
424 *(.debug_ranges)
425 }
a29a8af8
KT
426 .zdebug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
427 {
428 *(.zdebug_ranges)
429 }
802d4822
KT
430
431 /* DWARF 4. */
432 .debug_types ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
433 {
ebe9c501 434 *(.debug_types${RELOCATING+ .gnu.linkonce.wt.*})
802d4822 435 }
a29a8af8
KT
436 .zdebug_types ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
437 {
438 *(.zdebug_types${RELOCATING+ .zdebug.gnu.linkonce.wt.*})
439 }
786e3eba
NC
440
441 /* For Go and Rust. */
442 .debug_gdb_scripts ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
443 {
444 *(.debug_gdb_scripts)
445 }
446 .zdebug_gdb_scripts ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
447 {
448 *(.zdebug_gdb_scripts)
449 }
99ad8390
NC
450}
451EOF
This page took 0.509898 seconds and 4 git commands to generate.