blob: 9fac3d292e73ff52e11483c361f4fe1985f6a803 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001/* Script for --shared -z combreloc: shared library, combine & sort relocs */
2OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
3 "elf32-littlearm")
4OUTPUT_ARCH(arm)
5ENTRY(_start)
6SECTIONS
7{
8 /* Read-only sections, merged into text segment: */
9 . = 0 + SIZEOF_HEADERS;
10 .hash : { *(.hash) }
11 .dynsym : { *(.dynsym) }
12 .dynstr : { *(.dynstr) }
13 .gnu.version : { *(.gnu.version) }
14 .gnu.version_d : { *(.gnu.version_d) }
15 .gnu.version_r : { *(.gnu.version_r) }
16 .rel.dyn :
17 {
18 *(.rel.init)
19 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
20 *(.rel.fini)
21 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
22 *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
23 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
24 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
25 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
26 *(.rel.ctors)
27 *(.rel.dtors)
28 *(.rel.got)
29 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
30 }
31 .rela.dyn :
32 {
33 *(.rela.init)
34 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
35 *(.rela.fini)
36 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
37 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
38 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
39 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
40 *(.rela.ctors)
41 *(.rela.dtors)
42 *(.rela.got)
43 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
44 }
45 .rel.plt : { *(.rel.plt) }
46 .rela.plt : { *(.rela.plt) }
47 .init :
48 {
49 KEEP (*(.init))
50 } =0
51 .plt : { *(.plt) }
52 .text :
53 {
54 *(.text .stub .text.* .gnu.linkonce.t.*)
55 KEEP (*(.text.*personality*))
56 /* .gnu.warning sections are handled specially by elf32.em. */
57 *(.gnu.warning)
58 *(.glue_7t) *(.glue_7)
59 } =0
60 .fini :
61 {
62 KEEP (*(.fini))
63 } =0
64 PROVIDE (__etext = .);
65 PROVIDE (_etext = .);
66 PROVIDE (etext = .);
67 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
68 .rodata1 : { *(.rodata1) }
69 /* We have to wrap extab and exidx sections with KEEP because we use
70 --gc-sections. */
71 .ARM.extab : { KEEP (*(.ARM.extab* .gnu.linkonce.armextab.*)) }
72 __exidx_start = .;
73 .ARM.exidx : { KEEP (*(.ARM.exidx* .gnu.linkonce.armexidx.*)) }
74 __exidx_end = .;
75 .eh_frame_hdr : { *(.eh_frame_hdr) }
76 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
77 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
78 /* Adjust the address for the data segment. We want to align at exactly
79 a page boundary to make life easier for apriori. */
80 . = ALIGN(4096);
81 /* Exception handling */
82 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
83 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
84 /* Thread Local Storage sections */
85 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
86 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
87 .preinit_array :
88 {
89 KEEP (*(.preinit_array))
90 }
91 .init_array :
92 {
93 KEEP (*(SORT(.init_array.*)))
94 KEEP (*(.init_array))
95 }
96 .fini_array :
97 {
98 KEEP (*(.fini_array))
99 KEEP (*(SORT(.fini_array.*)))
100 }
101 .ctors :
102 {
103 /* gcc uses crtbegin.o to find the start of
104 the constructors, so we make sure it is
105 first. Because this is a wildcard, it
106 doesn't matter if the user does not
107 actually link against crtbegin.o; the
108 linker won't look for a file to match a
109 wildcard. The wildcard also means that it
110 doesn't matter which directory crtbegin.o
111 is in. */
112 KEEP (*crtbegin*.o(.ctors))
113 /* We don't want to include the .ctor section from
114 the crtend.o file until after the sorted ctors.
115 The .ctor section from the crtend file contains the
116 end of ctors marker and it must be last */
117 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
118 KEEP (*(SORT(.ctors.*)))
119 KEEP (*(.ctors))
120 }
121 .dtors :
122 {
123 KEEP (*crtbegin*.o(.dtors))
124 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
125 KEEP (*(SORT(.dtors.*)))
126 KEEP (*(.dtors))
127 }
128 .jcr : { KEEP (*(.jcr)) }
129 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
130 .dynamic : { *(.dynamic) }
131 .got : { *(.got.plt) *(.got) }
132 .data :
133 {
134 __data_start = . ;
135 *(.data .data.* .gnu.linkonce.d.*)
136 KEEP (*(.gnu.linkonce.d.*personality*))
137 SORT(CONSTRUCTORS)
138 }
139 .data1 : { *(.data1) }
140 _edata = .; PROVIDE (edata = .);
141 __bss_start = .;
142 __bss_start__ = .;
143 .bss :
144 {
145 *(.dynbss)
146 *(.bss .bss.* .gnu.linkonce.b.*)
147 *(COMMON)
148 /* Align here to ensure that the .bss section occupies space up to
149 _end. Align after .bss to ensure correct alignment even if the
150 .bss section disappears because there are no input sections.
151 FIXME: Why do we need it? When there is no .bss section, we don't
152 pad the .data section. */
153 . = ALIGN(. != 0 ? 32 / 8 : 1);
154 }
155 _bss_end__ = . ; __bss_end__ = . ;
156 . = ALIGN(32 / 8);
157 . = ALIGN(32 / 8);
158 __end__ = . ;
159 _end = .; PROVIDE (end = .);
160 /* Stabs debugging sections. */
161 .stab 0 : { *(.stab) }
162 .stabstr 0 : { *(.stabstr) }
163 .stab.excl 0 : { *(.stab.excl) }
164 .stab.exclstr 0 : { *(.stab.exclstr) }
165 .stab.index 0 : { *(.stab.index) }
166 .stab.indexstr 0 : { *(.stab.indexstr) }
167 .comment 0 : { *(.comment) }
168 /* DWARF debug sections.
169 Symbols in the DWARF debugging sections are relative to the beginning
170 of the section so we begin them at 0. */
171 /* DWARF 1 */
172 .debug 0 : { *(.debug) }
173 .line 0 : { *(.line) }
174 /* GNU DWARF 1 extensions */
175 .debug_srcinfo 0 : { *(.debug_srcinfo) }
176 .debug_sfnames 0 : { *(.debug_sfnames) }
177 /* DWARF 1.1 and DWARF 2 */
178 .debug_aranges 0 : { *(.debug_aranges) }
179 .debug_pubnames 0 : { *(.debug_pubnames) }
180 /* DWARF 2 */
181 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
182 .debug_abbrev 0 : { *(.debug_abbrev) }
183 .debug_line 0 : { *(.debug_line) }
184 .debug_frame 0 : { *(.debug_frame) }
185 .debug_str 0 : { *(.debug_str) }
186 .debug_loc 0 : { *(.debug_loc) }
187 .debug_macinfo 0 : { *(.debug_macinfo) }
188 /* SGI/MIPS DWARF 2 extensions */
189 .debug_weaknames 0 : { *(.debug_weaknames) }
190 .debug_funcnames 0 : { *(.debug_funcnames) }
191 .debug_typenames 0 : { *(.debug_typenames) }
192 .debug_varnames 0 : { *(.debug_varnames) }
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -0700193 /* Adding the word ABSOLUTE below, so that the _stack below won't float
194 into a random section. If _stack is not absolutely with .stack section,
195 we saw that sometimes _stack got inserted into the .debug_frame section
196 because it's processed by the linker at that moment. As a result, _stack
197 symbol will get wrongly moved and gelf_update_symshndx() will return
198 invalid data. */
The Android Open Source Project88b60792009-03-03 19:28:42 -0800199 .stack 0x80000 :
200 {
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -0700201 _stack = ABSOLUTE(.);
The Android Open Source Project88b60792009-03-03 19:28:42 -0800202 *(.stack)
203 }
204 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
205 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
206 /DISCARD/ : { *(.note.GNU-stack) }
207}