blob: fdb0c4d791cb7c31585b51cf4a984dda32b4b596 [file] [log] [blame]
Ben Cheng6e5a1b62014-04-08 14:53:42 -07001/* Script for ld --shared: link shared library */
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 . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
10 .note.gnu.build-id : { *(.note.gnu.build-id) }
11 .hash : { *(.hash) }
12 .gnu.hash : { *(.gnu.hash) }
13 .dynsym : { *(.dynsym) }
14 .dynstr : { *(.dynstr) }
15 .gnu.version : { *(.gnu.version) }
16 .gnu.version_d : { *(.gnu.version_d) }
17 .gnu.version_r : { *(.gnu.version_r) }
18 .rel.init : { *(.rel.init) }
19 .rela.init : { *(.rela.init) }
20 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
21 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
22 .rel.fini : { *(.rel.fini) }
23 .rela.fini : { *(.rela.fini) }
24 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
25 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
26 .rel.data.rel.ro : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) }
27 .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
28 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
29 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
30 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
31 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
32 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
33 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
34 .rel.ctors : { *(.rel.ctors) }
35 .rela.ctors : { *(.rela.ctors) }
36 .rel.dtors : { *(.rel.dtors) }
37 .rela.dtors : { *(.rela.dtors) }
38 .rel.got : { *(.rel.got) }
39 .rela.got : { *(.rela.got) }
40 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
41 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
42 .rel.iplt :
43 {
44 *(.rel.iplt)
45 }
46 .rela.iplt :
47 {
48 *(.rela.iplt)
49 }
50 .rel.plt :
51 {
52 *(.rel.plt)
53 }
54 .rela.plt :
55 {
56 *(.rela.plt)
57 }
58 .init :
59 {
60 KEEP (*(SORT_NONE(.init)))
61 }
62 .plt : { *(.plt) }
63 .iplt : { *(.iplt) }
64 .text :
65 {
66 *(.text.unlikely .text.*_unlikely .text.unlikely.*)
67 *(.text.exit .text.exit.*)
68 *(.text.startup .text.startup.*)
69 *(.text.hot .text.hot.*)
70 *(.text .stub .text.* .gnu.linkonce.t.*)
71 /* .gnu.warning sections are handled specially by elf32.em. */
72 *(.gnu.warning)
73 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
74 }
75 .fini :
76 {
77 KEEP (*(SORT_NONE(.fini)))
78 }
79 PROVIDE (__etext = .);
80 PROVIDE (_etext = .);
81 PROVIDE (etext = .);
82 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
83 .rodata1 : { *(.rodata1) }
84 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
85 PROVIDE_HIDDEN (__exidx_start = .);
86 .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
87 PROVIDE_HIDDEN (__exidx_end = .);
88 .eh_frame_hdr : { *(.eh_frame_hdr) }
89 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
90 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
91 .gcc_except_table.*) }
92 /* These sections are generated by the Sun/Oracle C++ compiler. */
93 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
94 .exception_ranges*) }
95 /* Adjust the address for the data segment. We want to adjust up to
96 the same address within the page on the next page up. */
97 . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));
98 /* Exception handling */
99 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
100 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
101 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
102 /* Thread Local Storage sections */
103 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
104 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
105 .preinit_array :
106 {
107 KEEP (*(.preinit_array))
108 }
109 .init_array :
110 {
111 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
112 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
113 }
114 .fini_array :
115 {
116 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
117 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
118 }
119 .ctors :
120 {
121 /* gcc uses crtbegin.o to find the start of
122 the constructors, so we make sure it is
123 first. Because this is a wildcard, it
124 doesn't matter if the user does not
125 actually link against crtbegin.o; the
126 linker won't look for a file to match a
127 wildcard. The wildcard also means that it
128 doesn't matter which directory crtbegin.o
129 is in. */
130 KEEP (*crtbegin.o(.ctors))
131 KEEP (*crtbegin?.o(.ctors))
132 /* We don't want to include the .ctor section from
133 the crtend.o file until after the sorted ctors.
134 The .ctor section from the crtend file contains the
135 end of ctors marker and it must be last */
136 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
137 KEEP (*(SORT(.ctors.*)))
138 KEEP (*(.ctors))
139 }
140 .dtors :
141 {
142 KEEP (*crtbegin.o(.dtors))
143 KEEP (*crtbegin?.o(.dtors))
144 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
145 KEEP (*(SORT(.dtors.*)))
146 KEEP (*(.dtors))
147 }
148 .jcr : { KEEP (*(.jcr)) }
149 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
150 .dynamic : { *(.dynamic) }
151 .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
152 .data :
153 {
154 __data_start = . ;
155 *(.data .data.* .gnu.linkonce.d.*)
156 SORT(CONSTRUCTORS)
157 }
158 .data1 : { *(.data1) }
159 _edata = .; PROVIDE (edata = .);
160 . = .;
161 __bss_start = .;
162 __bss_start__ = .;
163 .bss :
164 {
165 *(.dynbss)
166 *(.bss .bss.* .gnu.linkonce.b.*)
167 *(COMMON)
168 /* Align here to ensure that the .bss section occupies space up to
169 _end. Align after .bss to ensure correct alignment even if the
170 .bss section disappears because there are no input sections.
171 FIXME: Why do we need it? When there is no .bss section, we don't
172 pad the .data section. */
173 . = ALIGN(. != 0 ? 32 / 8 : 1);
174 }
175 _bss_end__ = . ; __bss_end__ = . ;
176 . = ALIGN(32 / 8);
177 . = SEGMENT_START("ldata-segment", .);
178 . = ALIGN(32 / 8);
179 __end__ = . ;
180 _end = .; PROVIDE (end = .);
181 /* Stabs debugging sections. */
182 .stab 0 : { *(.stab) }
183 .stabstr 0 : { *(.stabstr) }
184 .stab.excl 0 : { *(.stab.excl) }
185 .stab.exclstr 0 : { *(.stab.exclstr) }
186 .stab.index 0 : { *(.stab.index) }
187 .stab.indexstr 0 : { *(.stab.indexstr) }
188 .comment 0 : { *(.comment) }
189 /* DWARF debug sections.
190 Symbols in the DWARF debugging sections are relative to the beginning
191 of the section so we begin them at 0. */
192 /* DWARF 1 */
193 .debug 0 : { *(.debug) }
194 .line 0 : { *(.line) }
195 /* GNU DWARF 1 extensions */
196 .debug_srcinfo 0 : { *(.debug_srcinfo) }
197 .debug_sfnames 0 : { *(.debug_sfnames) }
198 /* DWARF 1.1 and DWARF 2 */
199 .debug_aranges 0 : { *(.debug_aranges) }
200 .debug_pubnames 0 : { *(.debug_pubnames) }
201 /* DWARF 2 */
202 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
203 .debug_abbrev 0 : { *(.debug_abbrev) }
204 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
205 .debug_frame 0 : { *(.debug_frame) }
206 .debug_str 0 : { *(.debug_str) }
207 .debug_loc 0 : { *(.debug_loc) }
208 .debug_macinfo 0 : { *(.debug_macinfo) }
209 /* SGI/MIPS DWARF 2 extensions */
210 .debug_weaknames 0 : { *(.debug_weaknames) }
211 .debug_funcnames 0 : { *(.debug_funcnames) }
212 .debug_typenames 0 : { *(.debug_typenames) }
213 .debug_varnames 0 : { *(.debug_varnames) }
214 /* DWARF 3 */
215 .debug_pubtypes 0 : { *(.debug_pubtypes) }
216 .debug_ranges 0 : { *(.debug_ranges) }
217 /* DWARF Extension. */
218 .debug_macro 0 : { *(.debug_macro) }
219 .stack 0x80000 :
220 {
221 _stack = .;
222 *(.stack)
223 }
224 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
225 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
226 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
227}