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