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 */'
62 ${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
63 ${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
64 ${OUTPUT_ARCH+OUTPUT_ARCH(${OUTPUT_ARCH})}
70 ${RELOCATING+/* Make the virtual address and file offset synced if the alignment is}
71 ${RELOCATING+ lower than the target page size. */}
72 ${RELOCATING+. = SIZEOF_HEADERS;}
73 ${RELOCATING+. = ALIGN(__section_alignment__);}
74 .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
76 ${RELOCATING+ *(.init)}
79 ${RELOCATING+ *(.text.*)}
80 ${RELOCATING+ *(.gnu.linkonce.t.*)}
83 ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
84 LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); }
85 ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
86 LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); }
87 ${RELOCATING+ *(.fini)}
88 /* ??? Why is .gcc_exc here? */
89 ${RELOCATING+ *(.gcc_exc)}
90 ${RELOCATING+PROVIDE (etext = .);}
91 ${RELOCATING+PROVIDE (_etext = .);}
92 ${RELOCATING+ *(.gcc_except_table)}
95 /* The Cygwin32 library uses a section to avoid copying certain data
96 on fork. This used to be named ".data$nocopy". The linker used
97 to include this between __data_start__ and __data_end__, but that
98 breaks building the cygwin32 dll. Instead, we name the section
99 ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
101 .data ${RELOCATING+BLOCK(__section_alignment__)} :
103 ${RELOCATING+__data_start__ = . ;}
108 ${RELOCATING+__data_end__ = . ;}
109 ${RELOCATING+*(.data_cygwin_nocopy)}
112 .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
115 ${RELOCATING+__rt_psrelocs_start = .;}
116 *(.rdata_runtime_pseudo_reloc)
117 ${RELOCATING+__rt_psrelocs_end = .;}
119 ${RELOCATING+__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;}
120 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
121 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
122 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
123 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
125 .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
130 .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
135 .bss ${RELOCATING+BLOCK(__section_alignment__)} :
137 ${RELOCATING+__bss_start__ = . ;}
140 ${RELOCATING+__bss_end__ = . ;}
143 .edata ${RELOCATING+BLOCK(__section_alignment__)} :
154 ${RELOCATING+ *(.note.GNU-stack)}
155 ${RELOCATING+ *(.gnu.lto_*)}
158 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
160 /* This cannot currently be handled with grouped sections.
161 See pe.em:sort_sections. */
163 ${RELOCATING+__IAT_start__ = .;}
165 ${RELOCATING+__IAT_end__ = .;}
168 .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
170 ${RELOCATING+___crt_xc_start__ = . ;}
172 ${RELOCATING+___crt_xc_end__ = . ;}
173 ${RELOCATING+___crt_xi_start__ = . ;}
175 ${RELOCATING+___crt_xi_end__ = . ;}
176 ${RELOCATING+___crt_xl_start__ = . ;}
178 /* ___crt_xl_end__ is defined in the TLS Directory support code */
179 ${RELOCATING+___crt_xp_start__ = . ;}
181 ${RELOCATING+___crt_xp_end__ = . ;}
182 ${RELOCATING+___crt_xt_start__ = . ;}
184 ${RELOCATING+___crt_xt_end__ = . ;}
187 /* Windows TLS expects .tls\$AAA to be at the start and .tls\$ZZZ to be
188 at the end of section. This is important because _tls_start MUST
189 be at the beginning of the section to enable SECREL32 relocations with TLS
191 .tls ${RELOCATING+BLOCK(__section_alignment__)} :
193 ${RELOCATING+___tls_start__ = . ;}
195 ${RELOCATING+___tls_end__ = . ;}
198 .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
200 /* end is deprecated, don't use it */
201 ${RELOCATING+PROVIDE (end = .);}
202 ${RELOCATING+PROVIDE ( _end = .);}
203 ${RELOCATING+ __end__ = .;}
206 .rsrc ${RELOCATING+BLOCK(__section_alignment__)} : SUBALIGN(4)
211 .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
216 .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
221 .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
226 /* DWARF debug sections.
227 Symbols in the DWARF debugging sections are relative to the beginning
228 of the section. Unlike other targets that fake this by putting the
229 section VMA at 0, the PE format will not allow it. */
231 /* DWARF 1.1 and DWARF 2. */
232 .debug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
236 .zdebug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
241 .debug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
245 .zdebug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
250 .debug_pubtypes ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
254 .zdebug_pubtypes ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
260 .debug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
262 *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*})
264 .zdebug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
266 *(.zdebug_info${RELOCATING+ .zdebug.gnu.linkonce.wi.*})
269 .debug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
273 .zdebug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
278 .debug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
282 .zdebug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
287 .debug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
291 .zdebug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
296 .debug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
300 .zdebug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
305 .debug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
309 .zdebug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
314 .debug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
318 .zdebug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
323 /* SGI/MIPS DWARF 2 extensions. */
324 .debug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
328 .zdebug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
333 .debug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
337 .zdebug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
342 .debug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
346 .zdebug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
351 .debug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
355 .zdebug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
360 .debug_macro ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
364 .zdebug_macro ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
370 .debug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
374 .zdebug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
380 .debug_types ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
382 *(.debug_types${RELOCATING+ .gnu.linkonce.wt.*})
384 .zdebug_types ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
386 *(.zdebug_types${RELOCATING+ .gnu.linkonce.wt.*})