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 R_DATA='*(SORT(.data$*))'
17 R_RDATA='*(SORT(.rdata$*))'
21 /* These zeroes mark the end of the import list. */
22 LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
27 R_CRT_XC='*(SORT(.CRT$XC*)) /* C initialization */'
28 R_CRT_XI='*(SORT(.CRT$XI*)) /* C++ initialization */'
29 R_CRT_XL='*(SORT(.CRT$XL*)) /* TLS callbacks */'
30 R_CRT_XP='*(SORT(.CRT$XP*)) /* Pre-termination */'
31 R_CRT_XT='*(SORT(.CRT$XT*)) /* Termination */'
36 R_RSRC='*(SORT(.rsrc$*))'
47 ${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
48 ${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
49 ${OUTPUT_ARCH+OUTPUT_ARCH(${OUTPUT_ARCH})}
57 ${RELOCATING+/* Make the virtual address and file offset synced if the alignment is}
58 ${RELOCATING+ lower than the target page size. */}
59 ${RELOCATING+. = SIZEOF_HEADERS;}
60 ${RELOCATING+. = ALIGN(__section_alignment__);}
61 .text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
63 ${RELOCATING+ *(.init)}
68 ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
69 LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); }
70 ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
71 LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); }
72 ${RELOCATING+ *(.fini)}
73 /* ??? Why is .gcc_exc here? */
74 ${RELOCATING+ *(.gcc_exc)}
75 ${RELOCATING+PROVIDE (etext = .);}
79 /* The Cygwin32 library uses a section to avoid copying certain data
80 on fork. This used to be named ".data$nocopy". The linker used
81 to include this between __data_start__ and __data_end__, but that
82 breaks building the cygwin32 dll. Instead, we name the section
83 ".data_cygwin_nocopy" and explictly include it after __data_end__. */
85 .data ${RELOCATING+BLOCK(__section_alignment__)} :
87 ${RELOCATING+__data_start__ = . ;}
92 ${RELOCATING+__data_end__ = . ;}
93 ${RELOCATING+*(.data_cygwin_nocopy)}
96 .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
101 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = .;}
102 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = .;}
103 *(.rdata_runtime_pseudo_reloc)
104 ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
105 ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
108 .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
113 .bss ${RELOCATING+BLOCK(__section_alignment__)} :
115 ${RELOCATING+__bss_start__ = . ;}
118 ${RELOCATING+__bss_end__ = . ;}
121 .edata ${RELOCATING+BLOCK(__section_alignment__)} :
134 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
136 /* This cannot currently be handled with grouped sections.
137 See pe.em:sort_sections. */
140 .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
142 ${RELOCATING+___crt_xc_start__ = . ;}
144 ${RELOCATING+___crt_xc_end__ = . ;}
145 ${RELOCATING+___crt_xi_start__ = . ;}
147 ${RELOCATING+___crt_xi_end__ = . ;}
148 ${RELOCATING+___crt_xl_start__ = . ;}
150 /* ___crt_xl_end__ is defined in the TLS Directory support code */
151 ${RELOCATING+___crt_xp_start__ = . ;}
153 ${RELOCATING+___crt_xp_end__ = . ;}
154 ${RELOCATING+___crt_xt_start__ = . ;}
156 ${RELOCATING+___crt_xt_end__ = . ;}
159 .tls ${RELOCATING+BLOCK(__section_alignment__)} :
161 ${RELOCATING+___tls_start__ = . ;}
163 ${RELOCATING+___tls_end__ = . ;}
166 .endjunk ${RELOCATING+BLOCK(__section_alignment__)} :
168 /* end is deprecated, don't use it */
169 ${RELOCATING+PROVIDE (end = .);}
170 ${RELOCATING+PROVIDE ( _end = .);}
171 ${RELOCATING+ __end__ = .;}
174 .rsrc ${RELOCATING+BLOCK(__section_alignment__)} :
180 .reloc ${RELOCATING+BLOCK(__section_alignment__)} :
185 .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
190 .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
195 /* DWARF debug sections.
196 Symbols in the DWARF debugging sections are relative to the beginning
197 of the section. Unlike other targets that fake this by putting the
198 section VMA at 0, the PE format will not allow it. */
200 /* DWARF 1.1 and DWARF 2. */
201 .debug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
206 .debug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
212 .debug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
214 *(.debug_info) *(.gnu.linkonce.wi.*)
217 .debug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
222 .debug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
227 .debug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
232 .debug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
237 .debug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
242 .debug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
247 /* SGI/MIPS DWARF 2 extensions. */
248 .debug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
253 .debug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
258 .debug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
263 .debug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :
269 .debug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} :