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+__text_start__ = .;}
73 ${RELOCATING+ *(.init)}
76 ${RELOCATING+ *(.text.*)}
79 ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
80 LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); }
81 ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
82 LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); }
83 ${RELOCATING+ *(.fini)}
84 /* ??? Why is .gcc_exc here? */
85 ${RELOCATING+ *(.gcc_exc)}
86 ${RELOCATING+PROVIDE (etext = .);}
87 ${RELOCATING+ *(.gcc_except_table)}
88 ${RELOCATING+__text_end__ = .;}
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 explictly include it after __data_end__. */
97 .data ${RELOCATING+BLOCK(__section_alignment__)} :
99 ${RELOCATING+__data_start__ = . ;}
104 ${RELOCATING+__data_end__ = . ;}
105 ${RELOCATING+*(.data_cygwin_nocopy)}
107 /* Stuff copied from BSS */
108 ${RELOCATING+__bss_start__ = . ;}
111 ${RELOCATING+__bss_end__ = . ;}
112 /* End stuff from BSS */
115 .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
117 /* Start original .rdata */
119 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = .;}
120 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = .;}
121 *(.rdata_runtime_pseudo_reloc)
122 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
123 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
124 /* End original .rdata */
126 ${RELOCATING+. = ALIGN(16);}
129 ${RELOCATING+__edata_start__ = .;}
131 ${RELOCATING+__edata_end__ = .;}
132 /* End moved .edata */
135 ${RELOCATING+. = ALIGN(16);}
138 /* This cannot currently be handled with grouped sections.
139 See pe.em:sort_sections. */
140 ${RELOCATING+__idata_start__ = .;}
142 ${RELOCATING+__idata5_start__ = .;}
144 ${RELOCATING+__idata5_end__ = .;}
146 ${RELOCATING+__idata_end__ = .;}
147 /* End moved .idata */
150 .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
155 .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
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 .tls ${RELOCATING+BLOCK(__section_alignment__)} :
189 ${RELOCATING+___tls_start__ = . ;}
191 ${RELOCATING+___tls_end__ = . ;}
194 .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
196 /* end is deprecated, don't use it */
197 ${RELOCATING+PROVIDE (end = .);}
198 ${RELOCATING+PROVIDE ( _end = .);}
199 ${RELOCATING+ __end__ = .;}
202 .rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
208 .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
213 .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
218 .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
223 /* DWARF debug sections.
224 Symbols in the DWARF debugging sections are relative to the beginning
225 of the section. Unlike other targets that fake this by putting the
226 section VMA at 0, the PE format will not allow it. */
228 /* DWARF 1.1 and DWARF 2. */
229 .debug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
234 .debug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
239 .debug_pubtypes ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
245 .debug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
247 *(.debug_info) *(.gnu.linkonce.wi.*)
250 .debug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
255 .debug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
260 .debug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
265 .debug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
270 .debug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
275 .debug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
280 /* SGI/MIPS DWARF 2 extensions. */
281 .debug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
286 .debug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
291 .debug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
296 .debug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
302 .debug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :