Commit | Line | Data |
---|---|---|
99ad8390 NC |
1 | # Linker script for PE. |
2 | ||
3 | if test -z "${RELOCATEABLE_OUTPUT_FORMAT}"; then | |
4 | RELOCATEABLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
5 | fi | |
6 | ||
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$*))' | |
e2a83dd0 NC |
16 | if test "x$LD_FLAG" = "xauto_import" ; then |
17 | R_DATA='*(SORT(.data$*)) | |
18 | *(.rdata) | |
19 | *(SORT(.rdata$*))' | |
20 | R_RDATA='' | |
21 | else | |
22 | R_DATA='*(SORT(.data$*))' | |
23 | R_RDATA='*(.rdata) | |
24 | *(SORT(.rdata$*))' | |
25 | fi | |
d4874973 | 26 | R_IDATA234=' |
99ad8390 NC |
27 | SORT(*)(.idata$2) |
28 | SORT(*)(.idata$3) | |
29 | /* These zeroes mark the end of the import list. */ | |
30 | LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); | |
d4874973 KT |
31 | SORT(*)(.idata$4)' |
32 | R_IDATA5='SORT(*)(.idata$5)' | |
33 | R_IDATA67=' | |
99ad8390 NC |
34 | SORT(*)(.idata$6) |
35 | SORT(*)(.idata$7)' | |
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 */' | |
41 | R_TLS=' | |
42 | *(.tls) | |
43 | *(.tls$) | |
44 | *(SORT(.tls$*))' | |
45 | R_RSRC='*(SORT(.rsrc$*))' | |
46 | else | |
47 | R_TEXT= | |
48 | R_DATA= | |
e2a83dd0 | 49 | R_RDATA='*(.rdata)' |
d4874973 KT |
50 | R_IDATA234= |
51 | R_IDATA5= | |
52 | R_IDATA67= | |
99ad8390 NC |
53 | R_CRT= |
54 | R_RSRC= | |
55 | fi | |
56 | ||
57 | cat <<EOF | |
58 | ${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})} | |
59 | ${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})} | |
60 | ${OUTPUT_ARCH+OUTPUT_ARCH(${OUTPUT_ARCH})} | |
61 | ||
62 | ${LIB_SEARCH_DIRS} | |
63 | ||
64 | SECTIONS | |
65 | { | |
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__ )} : | |
71 | { | |
72 | ${RELOCATING+ *(.init)} | |
73 | *(.text) | |
74 | ${R_TEXT} | |
032f3e01 | 75 | ${RELOCATING+ *(.text.*)} |
99ad8390 NC |
76 | *(.glue_7t) |
77 | *(.glue_7) | |
da6fa31a | 78 | ${CONSTRUCTING+. = ALIGN(8);} |
99ad8390 | 79 | ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; |
9b996610 | 80 | LONG (-1); LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0); LONG (0); } |
99ad8390 | 81 | ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; |
9b996610 | 82 | LONG (-1); LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0); LONG (0); } |
99ad8390 NC |
83 | ${RELOCATING+ *(.fini)} |
84 | /* ??? Why is .gcc_exc here? */ | |
85 | ${RELOCATING+ *(.gcc_exc)} | |
86 | ${RELOCATING+PROVIDE (etext = .);} | |
5f294ed6 | 87 | ${RELOCATING+ *(.gcc_except_table)} |
99ad8390 NC |
88 | } |
89 | ||
90 | /* The Cygwin32 library uses a section to avoid copying certain data | |
91 | on fork. This used to be named ".data$nocopy". The linker used | |
92 | to include this between __data_start__ and __data_end__, but that | |
93 | breaks building the cygwin32 dll. Instead, we name the section | |
94 | ".data_cygwin_nocopy" and explictly include it after __data_end__. */ | |
95 | ||
96 | .data ${RELOCATING+BLOCK(__section_alignment__)} : | |
97 | { | |
98 | ${RELOCATING+__data_start__ = . ;} | |
99 | *(.data) | |
100 | *(.data2) | |
101 | ${R_DATA} | |
102 | *(.jcr) | |
103 | ${RELOCATING+__data_end__ = . ;} | |
104 | ${RELOCATING+*(.data_cygwin_nocopy)} | |
105 | } | |
106 | ||
107 | .rdata ${RELOCATING+BLOCK(__section_alignment__)} : | |
108 | { | |
99ad8390 | 109 | ${R_RDATA} |
99ad8390 NC |
110 | ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = .;} |
111 | ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = .;} | |
112 | *(.rdata_runtime_pseudo_reloc) | |
113 | ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;} | |
114 | ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;} | |
115 | } | |
116 | ||
27505b5d TG |
117 | .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} : |
118 | { | |
119 | *(.eh_frame) | |
120 | } | |
121 | ||
99ad8390 NC |
122 | .pdata ${RELOCATING+BLOCK(__section_alignment__)} : |
123 | { | |
2d7f4929 KT |
124 | *(.pdata*) |
125 | } | |
126 | ||
127 | .xdata ${RELOCATING+BLOCK(__section_alignment__)} : | |
128 | { | |
129 | *(.xdata*) | |
99ad8390 NC |
130 | } |
131 | ||
132 | .bss ${RELOCATING+BLOCK(__section_alignment__)} : | |
133 | { | |
134 | ${RELOCATING+__bss_start__ = . ;} | |
135 | *(.bss) | |
136 | *(COMMON) | |
137 | ${RELOCATING+__bss_end__ = . ;} | |
138 | } | |
139 | ||
140 | .edata ${RELOCATING+BLOCK(__section_alignment__)} : | |
141 | { | |
142 | *(.edata) | |
143 | } | |
144 | ||
145 | /DISCARD/ : | |
146 | { | |
147 | *(.debug\$S) | |
148 | *(.debug\$T) | |
149 | *(.debug\$F) | |
150 | *(.drectve) | |
fecc36fd KT |
151 | ${RELOCATING+ *(.note.GNU-stack)} |
152 | ${RELOCATING+ *(.gnu.lto_*)} | |
99ad8390 NC |
153 | } |
154 | ||
155 | .idata ${RELOCATING+BLOCK(__section_alignment__)} : | |
156 | { | |
157 | /* This cannot currently be handled with grouped sections. | |
158 | See pep.em:sort_sections. */ | |
d4874973 KT |
159 | ${R_IDATA234} |
160 | ${RELOCATING+__IAT_start__ = .;} | |
161 | ${R_IDATA5} | |
162 | ${RELOCATING+__IAT_end__ = .;} | |
163 | ${R_IDATA67} | |
99ad8390 NC |
164 | } |
165 | .CRT ${RELOCATING+BLOCK(__section_alignment__)} : | |
166 | { | |
167 | ${RELOCATING+___crt_xc_start__ = . ;} | |
168 | ${R_CRT_XC} | |
169 | ${RELOCATING+___crt_xc_end__ = . ;} | |
170 | ${RELOCATING+___crt_xi_start__ = . ;} | |
171 | ${R_CRT_XI} | |
172 | ${RELOCATING+___crt_xi_end__ = . ;} | |
173 | ${RELOCATING+___crt_xl_start__ = . ;} | |
174 | ${R_CRT_XL} | |
175 | /* ___crt_xl_end__ is defined in the TLS Directory support code */ | |
176 | ${RELOCATING+___crt_xp_start__ = . ;} | |
177 | ${R_CRT_XP} | |
178 | ${RELOCATING+___crt_xp_end__ = . ;} | |
179 | ${RELOCATING+___crt_xt_start__ = . ;} | |
180 | ${R_CRT_XT} | |
181 | ${RELOCATING+___crt_xt_end__ = . ;} | |
182 | } | |
183 | ||
184 | .tls ${RELOCATING+BLOCK(__section_alignment__)} : | |
185 | { | |
186 | ${RELOCATING+___tls_start__ = . ;} | |
187 | ${R_TLS} | |
188 | ${RELOCATING+___tls_end__ = . ;} | |
189 | } | |
190 | ||
191 | .endjunk ${RELOCATING+BLOCK(__section_alignment__)} : | |
192 | { | |
193 | /* end is deprecated, don't use it */ | |
194 | ${RELOCATING+PROVIDE (end = .);} | |
195 | ${RELOCATING+PROVIDE ( _end = .);} | |
196 | ${RELOCATING+ __end__ = .;} | |
197 | } | |
198 | ||
199 | .rsrc ${RELOCATING+BLOCK(__section_alignment__)} : | |
200 | { | |
201 | *(.rsrc) | |
202 | ${R_RSRC} | |
203 | } | |
204 | ||
205 | .reloc ${RELOCATING+BLOCK(__section_alignment__)} : | |
206 | { | |
207 | *(.reloc) | |
208 | } | |
209 | ||
210 | .stab ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
211 | { | |
212 | *(.stab) | |
213 | } | |
214 | ||
215 | .stabstr ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
216 | { | |
217 | *(.stabstr) | |
218 | } | |
219 | ||
220 | /* DWARF debug sections. | |
221 | Symbols in the DWARF debugging sections are relative to the beginning | |
222 | of the section. Unlike other targets that fake this by putting the | |
223 | section VMA at 0, the PE format will not allow it. */ | |
224 | ||
225 | /* DWARF 1.1 and DWARF 2. */ | |
226 | .debug_aranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
227 | { | |
228 | *(.debug_aranges) | |
229 | } | |
230 | ||
231 | .debug_pubnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
232 | { | |
233 | *(.debug_pubnames) | |
234 | } | |
235 | ||
22418005 | 236 | .debug_pubtypes ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : |
a626fe20 KT |
237 | { |
238 | *(.debug_pubtypes) | |
239 | } | |
240 | ||
99ad8390 NC |
241 | /* DWARF 2. */ |
242 | .debug_info ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
243 | { | |
244 | *(.debug_info) *(.gnu.linkonce.wi.*) | |
245 | } | |
246 | ||
247 | .debug_abbrev ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
248 | { | |
249 | *(.debug_abbrev) | |
250 | } | |
251 | ||
252 | .debug_line ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
253 | { | |
254 | *(.debug_line) | |
255 | } | |
256 | ||
257 | .debug_frame ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
258 | { | |
259 | *(.debug_frame) | |
260 | } | |
261 | ||
262 | .debug_str ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
263 | { | |
264 | *(.debug_str) | |
265 | } | |
266 | ||
267 | .debug_loc ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
268 | { | |
269 | *(.debug_loc) | |
270 | } | |
271 | ||
272 | .debug_macinfo ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
273 | { | |
274 | *(.debug_macinfo) | |
275 | } | |
276 | ||
277 | /* SGI/MIPS DWARF 2 extensions. */ | |
278 | .debug_weaknames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
279 | { | |
280 | *(.debug_weaknames) | |
281 | } | |
282 | ||
283 | .debug_funcnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
284 | { | |
285 | *(.debug_funcnames) | |
286 | } | |
287 | ||
288 | .debug_typenames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
289 | { | |
290 | *(.debug_typenames) | |
291 | } | |
292 | ||
293 | .debug_varnames ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
294 | { | |
295 | *(.debug_varnames) | |
296 | } | |
297 | ||
298 | /* DWARF 3. */ | |
299 | .debug_ranges ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
300 | { | |
301 | *(.debug_ranges) | |
302 | } | |
802d4822 KT |
303 | |
304 | /* DWARF 4. */ | |
305 | .debug_types ${RELOCATING+BLOCK(__section_alignment__)} ${RELOCATING+(NOLOAD)} : | |
306 | { | |
307 | *(.debug_types) *(.gnu.linkonce.wt.*) | |
308 | } | |
99ad8390 NC |
309 | } |
310 | EOF |