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 */'
45 R_RSRC='*(SORT(.rsrc$*))'
58 ${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
59 ${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
60 ${OUTPUT_ARCH+OUTPUT_ARCH(${OUTPUT_ARCH})}
66 ${RELOCATING+/* Make the virtual address and file offset synced if the alignment is}
67 ${RELOCATING+ lower than the target page size. */}
68 ${RELOCATING+. = SIZEOF_HEADERS;}
69 ${RELOCATING+. = ALIGN(__section_alignment__);}
70 .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
72 ${RELOCATING+ *(.init)}
75 ${RELOCATING+ *(.text.*)}
76 ${RELOCATING+ *(.gnu.linkonce.t.*)}
79 ${CONSTRUCTING+. = ALIGN(8);}
80 ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
81 LONG (-1); LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); LONG (0); }
82 ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
83 LONG (-1); LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); LONG (0); }
84 ${RELOCATING+ *(.fini)}
85 /* ??? Why is .gcc_exc here? */
86 ${RELOCATING+ *(.gcc_exc)}
87 ${RELOCATING+PROVIDE (etext = .);}
88 ${RELOCATING+ *(.gcc_except_table)}
91 /* The Cygwin32 library uses a section to avoid copying certain data
92 on fork. This used to be named ".data$nocopy". The linker used
93 to include this between __data_start__ and __data_end__, but that
94 breaks building the cygwin32 dll. Instead, we name the section
95 ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
97 .data ${RELOCATING+BLOCK(__section_alignment__)} :
99 ${RELOCATING+__data_start__ = . ;}
104 ${RELOCATING+__data_end__ = . ;}
105 ${RELOCATING+*(.data_cygwin_nocopy)}
108 .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
111 ${RELOCATING+__rt_psrelocs_start = .;}
112 *(.rdata_runtime_pseudo_reloc)
113 ${RELOCATING+__rt_psrelocs_end = .;}
115 ${RELOCATING+__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;}
116 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
117 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
118 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
119 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
121 .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
126 .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
131 .xdata ${RELOCATING+BLOCK(__section_alignment__)} :
136 .bss ${RELOCATING+BLOCK(__section_alignment__)} :
138 ${RELOCATING+__bss_start__ = . ;}
141 ${RELOCATING+__bss_end__ = . ;}
144 .edata ${RELOCATING+BLOCK(__section_alignment__)} :
155 ${RELOCATING+ *(.note.GNU-stack)}
156 ${RELOCATING+ *(.gnu.lto_*)}
159 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
161 /* This cannot currently be handled with grouped sections.
162 See pep.em:sort_sections. */
164 ${RELOCATING+__IAT_start__ = .;}
166 ${RELOCATING+__IAT_end__ = .;}
169 .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
171 ${RELOCATING+___crt_xc_start__ = . ;}
173 ${RELOCATING+___crt_xc_end__ = . ;}
174 ${RELOCATING+___crt_xi_start__ = . ;}
176 ${RELOCATING+___crt_xi_end__ = . ;}
177 ${RELOCATING+___crt_xl_start__ = . ;}
179 /* ___crt_xl_end__ is defined in the TLS Directory support code */
180 ${RELOCATING+___crt_xp_start__ = . ;}
182 ${RELOCATING+___crt_xp_end__ = . ;}
183 ${RELOCATING+___crt_xt_start__ = . ;}
185 ${RELOCATING+___crt_xt_end__ = . ;}
188 .tls ${RELOCATING+BLOCK(__section_alignment__)} :
190 ${RELOCATING+___tls_start__ = . ;}
192 ${RELOCATING+___tls_end__ = . ;}
195 .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
197 /* end is deprecated, don't use it */
198 ${RELOCATING+PROVIDE (end = .);}
199 ${RELOCATING+PROVIDE ( _end = .);}
200 ${RELOCATING+ __end__ = .;}
203 .rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
209 .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
214 .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
219 .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
224 /* DWARF debug sections.
225 Symbols in the DWARF debugging sections are relative to the beginning
226 of the section. Unlike other targets that fake this by putting the
227 section VMA at 0, the PE format will not allow it. */
229 /* DWARF 1.1 and DWARF 2. */
230 .debug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
235 .debug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
240 .debug_pubtypes ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
246 .debug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
248 *(.debug_info${RELOCATING+ .gnu.linkonce.wi.*})
251 .debug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
256 .debug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
261 .debug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
266 .debug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
271 .debug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
276 .debug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
281 /* SGI/MIPS DWARF 2 extensions. */
282 .debug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
287 .debug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
292 .debug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
297 .debug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
302 .debug_macro ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
308 .debug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
314 .debug_types ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
316 *(.debug_types${RELOCATING+ .gnu.linkonce.wt.*})