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