1/* Default linker script, for normal executables */
2/* Modified for Android.  */
3OUTPUT_FORMAT("elf32-i386", "elf32-i386",
4	      "elf32-i386")
5OUTPUT_ARCH(i386)
6ENTRY(_start)
7SECTIONS
8{
9  /* Read-only sections, merged into text segment: */
10  PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS;
11  .interp         : { *(.interp) }
12  .note.gnu.build-id : { *(.note.gnu.build-id) }
13  .hash           : { *(.hash) }
14  .gnu.hash       : { *(.gnu.hash) }
15  .dynsym         : { *(.dynsym) }
16  .dynstr         : { *(.dynstr) }
17  .gnu.version    : { *(.gnu.version) }
18  .gnu.version_d  : { *(.gnu.version_d) }
19  .gnu.version_r  : { *(.gnu.version_r) }
20  .rel.init       : { *(.rel.init) }
21  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
22  .rel.fini       : { *(.rel.fini) }
23  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
24  .rel.data.rel.ro   : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) }
25  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
26  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
27  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
28  .rel.ctors      : { *(.rel.ctors) }
29  .rel.dtors      : { *(.rel.dtors) }
30  .rel.got        : { *(.rel.got) }
31  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
32  .rel.ifunc      : { *(.rel.ifunc) }
33  .rel.plt        :
34    {
35      *(.rel.plt)
36      PROVIDE_HIDDEN (__rel_iplt_start = .);
37      *(.rel.iplt)
38      PROVIDE_HIDDEN (__rel_iplt_end = .);
39    }
40  .init           :
41  {
42    KEEP (*(.init))
43  }
44  .plt            : { *(.plt) *(.iplt) }
45  .text           :
46  {
47    *(.text.unlikely .text.*_unlikely)
48    *(.text.exit .text.exit.*)
49    *(.text.startup .text.startup.*)
50    *(.text.hot .text.hot.*)
51    *(.text .stub .text.* .gnu.linkonce.t.*)
52    /* .gnu.warning sections are handled specially by elf32.em.  */
53    *(.gnu.warning)
54  }
55  .fini           :
56  {
57    KEEP (*(.fini))
58  }
59  PROVIDE (__etext = .);
60  PROVIDE (_etext = .);
61  PROVIDE (etext = .);
62  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
63  .rodata1        : { *(.rodata1) }
64  .eh_frame_hdr : { *(.eh_frame_hdr) }
65  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
66  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table
67  .gcc_except_table.*) }
68  /* These sections are generated by the Sun/Oracle C++ compiler.  */
69  .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
70  .exception_ranges*) }
71  /* Adjust the address for the data segment.  We want to align at exactly
72     a page boundary to make life easier for apriori. */
73  . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
74  /* Exception handling  */
75  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
76  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
77  .exception_ranges   : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
78  /* Thread Local Storage sections  */
79  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
80  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
81  /* Ensure the __preinit_array_start label is properly aligned.  We
82     could instead move the label definition inside the section, but
83     the linker would then create the section even if it turns out to
84     be empty, which isn't pretty.  */
85  . = ALIGN(32 / 8);
86  PROVIDE_HIDDEN (__preinit_array_start = .);
87  .preinit_array     :
88  {
89    KEEP (*(.preinit_array))
90  }
91  PROVIDE_HIDDEN (__preinit_array_end = .);
92  PROVIDE_HIDDEN (__init_array_start = .);
93  .init_array     :
94  {
95    KEEP (*crtbegin*.o(.init_array))
96    KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
97    KEEP (*(.init_array))
98    KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
99  }
100  PROVIDE_HIDDEN (__init_array_end = .);
101  PROVIDE_HIDDEN (__fini_array_start = .);
102  .fini_array     :
103  {
104    KEEP (*crtbegin*.o(.fini_array))
105    KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
106    KEEP (*(.fini_array))
107    KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
108  }
109  PROVIDE_HIDDEN (__fini_array_end = .);
110  .ctors          :
111  {
112    /* gcc uses crtbegin.o to find the start of
113       the constructors, so we make sure it is
114       first.  Because this is a wildcard, it
115       doesn't matter if the user does not
116       actually link against crtbegin.o; the
117       linker won't look for a file to match a
118       wildcard.  The wildcard also means that it
119       doesn't matter which directory crtbegin.o
120       is in.  */
121    KEEP (*crtbegin.o(.ctors))
122    KEEP (*crtbegin*.o(.ctors))
123    /* We don't want to include the .ctor section from
124       the crtend.o file until after the sorted ctors.
125       The .ctor section from the crtend file contains the
126       end of ctors marker and it must be last */
127    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors))
128    KEEP (*(SORT(.ctors.*)))
129    KEEP (*(.ctors))
130  }
131  .dtors          :
132  {
133    KEEP (*crtbegin.o(.dtors))
134    KEEP (*crtbegin*.o(.dtors))
135    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors))
136    KEEP (*(SORT(.dtors.*)))
137    KEEP (*(.dtors))
138  }
139  .jcr            : { KEEP (*(.jcr)) }
140  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
141  .dynamic        : { *(.dynamic) }
142  .got            : { *(.got) *(.igot) }
143  . = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 12 ? 12 : 0, .);
144  .got.plt        : { *(.got.plt)  *(.igot.plt) }
145  .data           :
146  {
147    *(.data .data.* .gnu.linkonce.d.*)
148    SORT(CONSTRUCTORS)
149  }
150  .data1          : { *(.data1) }
151  _edata = .; PROVIDE (edata = .);
152  . = .;
153  __bss_start = .;
154  .bss            :
155  {
156   *(.dynbss)
157   *(.bss .bss.* .gnu.linkonce.b.*)
158   *(COMMON)
159   /* Align here to ensure that the .bss section occupies space up to
160      _end.  Align after .bss to ensure correct alignment even if the
161      .bss section disappears because there are no input sections.  */
162   . = ALIGN(32 / 8);
163  }
164  . = ALIGN(32 / 8);
165  . = ALIGN(32 / 8);
166  _end = .;
167  _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
168  PROVIDE (end = .);
169  . = DATA_SEGMENT_END (.);
170  /* Stabs debugging sections.  */
171  .stab          0 : { *(.stab) }
172  .stabstr       0 : { *(.stabstr) }
173  .stab.excl     0 : { *(.stab.excl) }
174  .stab.exclstr  0 : { *(.stab.exclstr) }
175  .stab.index    0 : { *(.stab.index) }
176  .stab.indexstr 0 : { *(.stab.indexstr) }
177  .comment       0 : { *(.comment) }
178  /* DWARF debug sections.
179     Symbols in the DWARF debugging sections are relative to the beginning
180     of the section so we begin them at 0.  */
181  /* DWARF 1 */
182  .debug          0 : { *(.debug) }
183  .line           0 : { *(.line) }
184  /* GNU DWARF 1 extensions */
185  .debug_srcinfo  0 : { *(.debug_srcinfo) }
186  .debug_sfnames  0 : { *(.debug_sfnames) }
187  /* DWARF 1.1 and DWARF 2 */
188  .debug_aranges  0 : { *(.debug_aranges) }
189  .debug_pubnames 0 : { *(.debug_pubnames) }
190  /* DWARF 2 */
191  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
192  .debug_abbrev   0 : { *(.debug_abbrev) }
193  .debug_line     0 : { *(.debug_line) }
194  .debug_frame    0 : { *(.debug_frame) }
195  .debug_str      0 : { *(.debug_str) }
196  .debug_loc      0 : { *(.debug_loc) }
197  .debug_macinfo  0 : { *(.debug_macinfo) }
198  /* SGI/MIPS DWARF 2 extensions */
199  .debug_weaknames 0 : { *(.debug_weaknames) }
200  .debug_funcnames 0 : { *(.debug_funcnames) }
201  .debug_typenames 0 : { *(.debug_typenames) }
202  .debug_varnames  0 : { *(.debug_varnames) }
203  /* DWARF 3 */
204  .debug_pubtypes 0 : { *(.debug_pubtypes) }
205  .debug_ranges   0 : { *(.debug_ranges) }
206  /* DWARF Extension.  */
207  .debug_macro    0 : { *(.debug_macro) }
208  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
209  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) }
210}
211