1/* Script for ld --enable-auto-import: Like the default script except read only data is placed into .data  */
2/* Copyright (C) 2014 Free Software Foundation, Inc.
3   Copying and distribution of this script, with or without modification,
4   are permitted in any medium without royalty provided the copyright
5   notice and this notice are preserved.  */
6OUTPUT_FORMAT(pei-i386)
7SECTIONS
8{
9  /* Make the virtual address and file offset synced if the alignment is
10     lower than the target page size. */
11  . = SIZEOF_HEADERS;
12  . = ALIGN(__section_alignment__);
13  .text  __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) :
14  {
15     *(.init)
16    *(.text)
17    *(SORT(.text$*))
18     *(.text.*)
19     *(.gnu.linkonce.t.*)
20    *(.glue_7t)
21    *(.glue_7)
22     ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
23			LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));  LONG (0);
24     ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
25			LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*));  LONG (0);
26     *(.fini)
27    /* ??? Why is .gcc_exc here?  */
28     *(.gcc_exc)
29    PROVIDE (etext = .);
30    PROVIDE (_etext = .);
31     *(.gcc_except_table)
32  }
33  /* The Cygwin32 library uses a section to avoid copying certain data
34     on fork.  This used to be named ".data".  The linker used
35     to include this between __data_start__ and __data_end__, but that
36     breaks building the cygwin32 dll.  Instead, we name the section
37     ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
38  .data BLOCK(__section_alignment__) :
39  {
40    __data_start__ = . ;
41    *(.data)
42    *(.data2)
43    *(SORT(.data$*))
44            *(.rdata)
45	    *(SORT(.rdata$*))
46    *(.jcr)
47    __data_end__ = . ;
48    *(.data_cygwin_nocopy)
49  }
50  .rdata BLOCK(__section_alignment__) :
51  {
52    __rt_psrelocs_start = .;
53    *(.rdata_runtime_pseudo_reloc)
54    __rt_psrelocs_end = .;
55  }
56  __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;
57  ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
58  __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
59  ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
60  __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
61  .eh_frame BLOCK(__section_alignment__) :
62  {
63    *(.eh_frame*)
64  }
65  .pdata BLOCK(__section_alignment__) :
66  {
67    *(.pdata)
68  }
69  .bss BLOCK(__section_alignment__) :
70  {
71    __bss_start__ = . ;
72    *(.bss)
73    *(COMMON)
74    __bss_end__ = . ;
75  }
76  .edata BLOCK(__section_alignment__) :
77  {
78    *(.edata)
79  }
80  /DISCARD/ :
81  {
82    *(.debug$S)
83    *(.debug$T)
84    *(.debug$F)
85    *(.drectve)
86     *(.note.GNU-stack)
87     *(.gnu.lto_*)
88  }
89  .idata BLOCK(__section_alignment__) :
90  {
91    /* This cannot currently be handled with grouped sections.
92	See pe.em:sort_sections.  */
93    SORT(*)(.idata$2)
94    SORT(*)(.idata$3)
95    /* These zeroes mark the end of the import list.  */
96    LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
97    SORT(*)(.idata$4)
98    __IAT_start__ = .;
99    SORT(*)(.idata$5)
100    __IAT_end__ = .;
101    SORT(*)(.idata$6)
102    SORT(*)(.idata$7)
103  }
104  .CRT BLOCK(__section_alignment__) :
105  {
106    ___crt_xc_start__ = . ;
107    *(SORT(.CRT$XC*))  /* C initialization */
108    ___crt_xc_end__ = . ;
109    ___crt_xi_start__ = . ;
110    *(SORT(.CRT$XI*))  /* C++ initialization */
111    ___crt_xi_end__ = . ;
112    ___crt_xl_start__ = . ;
113    *(SORT(.CRT$XL*))  /* TLS callbacks */
114    /* ___crt_xl_end__ is defined in the TLS Directory support code */
115    ___crt_xp_start__ = . ;
116    *(SORT(.CRT$XP*))  /* Pre-termination */
117    ___crt_xp_end__ = . ;
118    ___crt_xt_start__ = . ;
119    *(SORT(.CRT$XT*))  /* Termination */
120    ___crt_xt_end__ = . ;
121  }
122  /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be
123     at the end of section.  This is important because _tls_start MUST
124     be at the beginning of the section to enable SECREL32 relocations with TLS
125     data.  */
126  .tls BLOCK(__section_alignment__) :
127  {
128    ___tls_start__ = . ;
129    *(.tls$AAA)
130    *(.tls)
131    *(.tls$)
132    *(SORT(.tls$*))
133    *(.tls$ZZZ)
134    ___tls_end__ = . ;
135  }
136  .endjunk BLOCK(__section_alignment__) :
137  {
138    /* end is deprecated, don't use it */
139    PROVIDE (end = .);
140    PROVIDE ( _end = .);
141     __end__ = .;
142  }
143  .rsrc BLOCK(__section_alignment__) : SUBALIGN(4)
144  {
145    *(.rsrc)
146    *(.rsrc$*)
147  }
148  .reloc BLOCK(__section_alignment__) :
149  {
150    *(.reloc)
151  }
152  .stab BLOCK(__section_alignment__) (NOLOAD) :
153  {
154    *(.stab)
155  }
156  .stabstr BLOCK(__section_alignment__) (NOLOAD) :
157  {
158    *(.stabstr)
159  }
160  /* DWARF debug sections.
161     Symbols in the DWARF debugging sections are relative to the beginning
162     of the section.  Unlike other targets that fake this by putting the
163     section VMA at 0, the PE format will not allow it.  */
164  /* DWARF 1.1 and DWARF 2.  */
165  .debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
166  {
167    *(.debug_aranges)
168  }
169  .zdebug_aranges BLOCK(__section_alignment__) (NOLOAD) :
170  {
171    *(.zdebug_aranges)
172  }
173  .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
174  {
175    *(.debug_pubnames)
176  }
177  .zdebug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
178  {
179    *(.zdebug_pubnames)
180  }
181  .debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
182  {
183    *(.debug_pubtypes)
184  }
185  .zdebug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
186  {
187    *(.zdebug_pubtypes)
188  }
189  /* DWARF 2.  */
190  .debug_info BLOCK(__section_alignment__) (NOLOAD) :
191  {
192    *(.debug_info .gnu.linkonce.wi.*)
193  }
194  .zdebug_info BLOCK(__section_alignment__) (NOLOAD) :
195  {
196    *(.zdebug_info .zdebug.gnu.linkonce.wi.*)
197  }
198  .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
199  {
200    *(.debug_abbrev)
201  }
202  .zdebug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
203  {
204    *(.zdebug_abbrev)
205  }
206  .debug_line BLOCK(__section_alignment__) (NOLOAD) :
207  {
208    *(.debug_line)
209  }
210  .zdebug_line BLOCK(__section_alignment__) (NOLOAD) :
211  {
212    *(.zdebug_line)
213  }
214  .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
215  {
216    *(.debug_frame*)
217  }
218  .zdebug_frame BLOCK(__section_alignment__) (NOLOAD) :
219  {
220    *(.zdebug_frame*)
221  }
222  .debug_str BLOCK(__section_alignment__) (NOLOAD) :
223  {
224    *(.debug_str)
225  }
226  .zdebug_str BLOCK(__section_alignment__) (NOLOAD) :
227  {
228    *(.zdebug_str)
229  }
230  .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
231  {
232    *(.debug_loc)
233  }
234  .zdebug_loc BLOCK(__section_alignment__) (NOLOAD) :
235  {
236    *(.zdebug_loc)
237  }
238  .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
239  {
240    *(.debug_macinfo)
241  }
242  .zdebug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
243  {
244    *(.zdebug_macinfo)
245  }
246  /* SGI/MIPS DWARF 2 extensions.  */
247  .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
248  {
249    *(.debug_weaknames)
250  }
251  .zdebug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
252  {
253    *(.zdebug_weaknames)
254  }
255  .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
256  {
257    *(.debug_funcnames)
258  }
259  .zdebug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
260  {
261    *(.zdebug_funcnames)
262  }
263  .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
264  {
265    *(.debug_typenames)
266  }
267  .zdebug_typenames BLOCK(__section_alignment__) (NOLOAD) :
268  {
269    *(.zdebug_typenames)
270  }
271  .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
272  {
273    *(.debug_varnames)
274  }
275  .zdebug_varnames BLOCK(__section_alignment__) (NOLOAD) :
276  {
277    *(.zdebug_varnames)
278  }
279  .debug_macro BLOCK(__section_alignment__) (NOLOAD) :
280  {
281    *(.debug_macro)
282  }
283  .zdebug_macro BLOCK(__section_alignment__) (NOLOAD) :
284  {
285    *(.zdebug_macro)
286  }
287  /* DWARF 3.  */
288  .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
289  {
290    *(.debug_ranges)
291  }
292  .zdebug_ranges BLOCK(__section_alignment__) (NOLOAD) :
293  {
294    *(.zdebug_ranges)
295  }
296  /* DWARF 4.  */
297  .debug_types BLOCK(__section_alignment__) (NOLOAD) :
298  {
299    *(.debug_types .gnu.linkonce.wt.*)
300  }
301  .zdebug_types BLOCK(__section_alignment__) (NOLOAD) :
302  {
303    *(.zdebug_types .gnu.linkonce.wt.*)
304  }
305}
306