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