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