1 # Linker script for PE.
3 if test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then
4 RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
7 # We can't easily and portably get an unquoted $ in a shell
8 # substitution, so we do this instead.
9 # Sorting of the .foo$* sections is required by the definition of
10 # grouped sections in PE.
11 # Sorting of the file names in R_IDATA is required by the
12 # current implementation of dlltool (this could probably be changed to
13 # use grouped sections instead).
14 if test "${RELOCATING}"; then
15 R_TEXT='*(SORT(.text$*))'
16 if test "x$LD_FLAG" = "xauto_import" ; then
17 R_DATA='*(SORT(.data$*))
22 R_DATA='*(SORT(.data$*))'
29 /* These zeroes mark the end of the import list. */
30 LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
32 R_IDATA5='SORT(*)(.idata$5)'
36 R_CRT_XC='*(SORT(.CRT$XC*)) /* C initialization */'
37 R_CRT_XI='*(SORT(.CRT$XI*)) /* C++ initialization */'
38 R_CRT_XL='*(SORT(.CRT$XL*)) /* TLS callbacks */'
39 R_CRT_XP='*(SORT(.CRT$XP*)) /* Pre-termination */'
40 R_CRT_XT='*(SORT(.CRT$XT*)) /* Termination */'
47 if test -z "$DEFAULT_MANIFEST"; then
53 /* The default manifest contains information necessary for
54 binaries to run under Windows 8 (or later). It is included as
55 the last resource file so that if the application has provided
56 its own manifest then that one will take precedence.
58 Note - the .rsrc section merging code relies upon the fact
59 that the input .rsrc sections are *not* sorted. */
60 *(EXCLUDE_FILE (*$DEFAULT_MANIFEST) .rsrc)
62 KEEP ($DEFAULT_MANIFEST(.rsrc))"
76 ${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
77 ${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
78 ${OUTPUT_ARCH+OUTPUT_ARCH(${OUTPUT_ARCH})}
84 ${RELOCATING+/* Make the virtual address and file offset synced if the alignment is}
85 ${RELOCATING+ lower than the target page size. */}
86 ${RELOCATING+. = SIZEOF_HEADERS;}
87 ${RELOCATING+. = ALIGN(__section_alignment__);}
88 .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
90 ${RELOCATING+ *(.init)}
93 ${RELOCATING+ *(.text.*)}
94 ${RELOCATING+ *(.gnu.linkonce.t.*)}
97 ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
98 LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); }
99 ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
100 LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); }
101 ${RELOCATING+ *(.fini)}
102 /* ??? Why is .gcc_exc here? */
103 ${RELOCATING+ *(.gcc_exc)}
104 ${RELOCATING+PROVIDE (etext = .);}
105 ${RELOCATING+PROVIDE (_etext = .);}
106 ${RELOCATING+ *(.gcc_except_table)}
109 /* The Cygwin32 library uses a section to avoid copying certain data
110 on fork. This used to be named ".data$nocopy". The linker used
111 to include this between __data_start__ and __data_end__, but that
112 breaks building the cygwin32 dll. Instead, we name the section
113 ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
115 .data ${RELOCATING+BLOCK(__section_alignment__)} :
117 ${RELOCATING+__data_start__ = . ;}
122 ${RELOCATING+__data_end__ = . ;}
123 ${RELOCATING+*(.data_cygwin_nocopy)}
126 .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
129 ${RELOCATING+__rt_psrelocs_start = .;}
130 *(.rdata_runtime_pseudo_reloc)
131 ${RELOCATING+__rt_psrelocs_end = .;}
133 ${RELOCATING+__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;}
134 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
135 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
136 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
137 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
139 .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
144 .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
149 .bss ${RELOCATING+BLOCK(__section_alignment__)} :
151 ${RELOCATING+__bss_start__ = . ;}
154 ${RELOCATING+__bss_end__ = . ;}
157 .edata ${RELOCATING+BLOCK(__section_alignment__)} :
168 ${RELOCATING+ *(.note.GNU-stack)}
169 ${RELOCATING+ *(.gnu.lto_*)}
172 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
174 /* This cannot currently be handled with grouped sections.
175 See pe.em:sort_sections. */
177 ${RELOCATING+__IAT_start__ = .;}
179 ${RELOCATING+__IAT_end__ = .;}
182 .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
184 ${RELOCATING+___crt_xc_start__ = . ;}
186 ${RELOCATING+___crt_xc_end__ = . ;}
187 ${RELOCATING+___crt_xi_start__ = . ;}
189 ${RELOCATING+___crt_xi_end__ = . ;}
190 ${RELOCATING+___crt_xl_start__ = . ;}
192 /* ___crt_xl_end__ is defined in the TLS Directory support code */
193 ${RELOCATING+___crt_xp_start__ = . ;}
195 ${RELOCATING+___crt_xp_end__ = . ;}
196 ${RELOCATING+___crt_xt_start__ = . ;}
198 ${RELOCATING+___crt_xt_end__ = . ;}
201 /* Windows TLS expects .tls\$AAA to be at the start and .tls\$ZZZ to be
202 at the end of section. This is important because _tls_start MUST
203 be at the beginning of the section to enable SECREL32 relocations with TLS
205 .tls ${RELOCATING+BLOCK(__section_alignment__)} :
207 ${RELOCATING+___tls_start__ = . ;}
209 ${RELOCATING+___tls_end__ = . ;}
212 .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
214 /* end is deprecated, don't use it */
215 ${RELOCATING+PROVIDE (end = .);}
216 ${RELOCATING+PROVIDE ( _end = .);}
217 ${RELOCATING+ __end__ = .;}
220 .rsrc ${RELOCATING+BLOCK(__section_alignment__)} : SUBALIGN(4)
225 .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
230 .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
235 .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
240 /* DWARF debug sections.
241 Symbols in the DWARF debugging sections are relative to the beginning
242 of the section. Unlike other targets that fake this by putting the
243 section VMA at 0, the PE format will not allow it. */
245 /* DWARF 1.1 and DWARF 2. */
246 .debug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
250 .zdebug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
255 .debug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
259 .zdebug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
264 .debug_pubtypes ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
268 .zdebug_pubtypes ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
274 .debug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
276 *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*})
278 .zdebug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
280 *(.zdebug_info${RELOCATING+ .zdebug.gnu.linkonce.wi.*})
283 .debug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
287 .zdebug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
292 .debug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
296 .zdebug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
301 .debug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
305 .zdebug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
310 .debug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
314 .zdebug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
319 .debug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
323 .zdebug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
328 .debug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
332 .zdebug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
337 /* SGI/MIPS DWARF 2 extensions. */
338 .debug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
342 .zdebug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
347 .debug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
351 .zdebug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
356 .debug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
360 .zdebug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
365 .debug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
369 .zdebug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
374 .debug_macro ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
378 .zdebug_macro ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
384 .debug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
388 .zdebug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
394 .debug_types ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
396 *(.debug_types${RELOCATING+ .gnu.linkonce.wt.*})
398 .zdebug_types ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
400 *(.zdebug_types${RELOCATING+ .gnu.linkonce.wt.*})