blob: c1971796d823476354cac318c5f65a0061cd0b34 [file] [log] [blame]
Rong Xu90135de2014-09-05 14:09:07 -07001/* Script for --shared -z combreloc: shared library, combine & sort relocs */
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-bigarm", "elf32-bigarm",
7 "elf32-littlearm")
8OUTPUT_ARCH(arm)
9ENTRY(_start)
Caroline Tice69686ab2018-02-05 16:43:21 -080010SEARCH_DIR("=/tmp/34269abe420208e092316e702cdce5df/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.dyn :
24 {
25 *(.rel.init)
26 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
27 *(.rel.fini)
28 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
29 *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
30 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
31 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
32 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
33 *(.rel.ctors)
34 *(.rel.dtors)
35 *(.rel.got)
36 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
37 *(.rel.iplt)
38 }
39 .rela.dyn :
40 {
41 *(.rela.init)
42 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
43 *(.rela.fini)
44 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
45 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
46 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
47 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
48 *(.rela.ctors)
49 *(.rela.dtors)
50 *(.rela.got)
51 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
52 *(.rela.iplt)
53 }
54 .rel.plt :
55 {
56 *(.rel.plt)
57 }
58 .rela.plt :
59 {
60 *(.rela.plt)
61 }
62 .init :
63 {
64 KEEP (*(SORT_NONE(.init)))
65 }
66 .plt : { *(.plt) }
67 .iplt : { *(.iplt) }
68 .text :
69 {
70 *(.text.unlikely .text.*_unlikely .text.unlikely.*)
71 *(.text.exit .text.exit.*)
72 *(.text.startup .text.startup.*)
73 *(.text.hot .text.hot.*)
74 *(.text .stub .text.* .gnu.linkonce.t.*)
75 /* .gnu.warning sections are handled specially by elf32.em. */
76 *(.gnu.warning)
77 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
78 }
79 .fini :
80 {
81 KEEP (*(SORT_NONE(.fini)))
82 }
83 PROVIDE (__etext = .);
84 PROVIDE (_etext = .);
85 PROVIDE (etext = .);
86 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
87 .rodata1 : { *(.rodata1) }
88 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
89 PROVIDE_HIDDEN (__exidx_start = .);
90 .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
91 PROVIDE_HIDDEN (__exidx_end = .);
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -070092 .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
93 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
Rong Xu90135de2014-09-05 14:09:07 -070094 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
95 .gcc_except_table.*) }
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -070096 .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) }
Rong Xu90135de2014-09-05 14:09:07 -070097 /* These sections are generated by the Sun/Oracle C++ compiler. */
98 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
99 .exception_ranges*) }
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700100 /* Adjust the address for the data segment. We want to adjust up to
101 the same address within the page on the next page up. */
102 . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
Rong Xu90135de2014-09-05 14:09:07 -0700103 /* Exception handling */
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700104 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
105 .gnu_extab : ONLY_IF_RW { *(.gnu_extab) }
Rong Xu90135de2014-09-05 14:09:07 -0700106 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
107 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
108 /* Thread Local Storage sections */
109 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
110 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
Rong Xu90135de2014-09-05 14:09:07 -0700111 .preinit_array :
112 {
113 KEEP (*(.preinit_array))
114 }
115 .init_array :
116 {
Rong Xu90135de2014-09-05 14:09:07 -0700117 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700118 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
Rong Xu90135de2014-09-05 14:09:07 -0700119 }
120 .fini_array :
121 {
Rong Xu90135de2014-09-05 14:09:07 -0700122 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700123 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
Rong Xu90135de2014-09-05 14:09:07 -0700124 }
125 .ctors :
126 {
127 /* gcc uses crtbegin.o to find the start of
128 the constructors, so we make sure it is
129 first. Because this is a wildcard, it
130 doesn't matter if the user does not
131 actually link against crtbegin.o; the
132 linker won't look for a file to match a
133 wildcard. The wildcard also means that it
134 doesn't matter which directory crtbegin.o
135 is in. */
136 KEEP (*crtbegin.o(.ctors))
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700137 KEEP (*crtbegin?.o(.ctors))
Rong Xu90135de2014-09-05 14:09:07 -0700138 /* We don't want to include the .ctor section from
139 the crtend.o file until after the sorted ctors.
140 The .ctor section from the crtend file contains the
141 end of ctors marker and it must be last */
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700142 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
Rong Xu90135de2014-09-05 14:09:07 -0700143 KEEP (*(SORT(.ctors.*)))
144 KEEP (*(.ctors))
145 }
146 .dtors :
147 {
148 KEEP (*crtbegin.o(.dtors))
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700149 KEEP (*crtbegin?.o(.dtors))
150 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
Rong Xu90135de2014-09-05 14:09:07 -0700151 KEEP (*(SORT(.dtors.*)))
152 KEEP (*(.dtors))
153 }
154 .jcr : { KEEP (*(.jcr)) }
155 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
156 .dynamic : { *(.dynamic) }
157 . = DATA_SEGMENT_RELRO_END (0, .);
158 .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
159 .data :
160 {
161 PROVIDE (__data_start = .);
162 *(.data .data.* .gnu.linkonce.d.*)
163 SORT(CONSTRUCTORS)
164 }
165 .data1 : { *(.data1) }
166 _edata = .; PROVIDE (edata = .);
Rong Xu90135de2014-09-05 14:09:07 -0700167 __bss_start = .;
168 __bss_start__ = .;
169 .bss :
170 {
171 *(.dynbss)
172 *(.bss .bss.* .gnu.linkonce.b.*)
173 *(COMMON)
174 /* Align here to ensure that the .bss section occupies space up to
175 _end. Align after .bss to ensure correct alignment even if the
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700176 .bss section disappears because there are no input sections.
177 FIXME: Why do we need it? When there is no .bss section, we don't
178 pad the .data section. */
179 . = ALIGN(. != 0 ? 32 / 8 : 1);
Rong Xu90135de2014-09-05 14:09:07 -0700180 }
181 _bss_end__ = . ; __bss_end__ = . ;
182 . = ALIGN(32 / 8);
183 . = SEGMENT_START("ldata-segment", .);
184 . = ALIGN(32 / 8);
185 __end__ = . ;
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700186 _end = .; PROVIDE (end = .);
Rong Xu90135de2014-09-05 14:09:07 -0700187 . = DATA_SEGMENT_END (.);
188 /* Stabs debugging sections. */
189 .stab 0 : { *(.stab) }
190 .stabstr 0 : { *(.stabstr) }
191 .stab.excl 0 : { *(.stab.excl) }
192 .stab.exclstr 0 : { *(.stab.exclstr) }
193 .stab.index 0 : { *(.stab.index) }
194 .stab.indexstr 0 : { *(.stab.indexstr) }
195 .comment 0 : { *(.comment) }
196 /* DWARF debug sections.
197 Symbols in the DWARF debugging sections are relative to the beginning
198 of the section so we begin them at 0. */
199 /* DWARF 1 */
200 .debug 0 : { *(.debug) }
201 .line 0 : { *(.line) }
202 /* GNU DWARF 1 extensions */
203 .debug_srcinfo 0 : { *(.debug_srcinfo) }
204 .debug_sfnames 0 : { *(.debug_sfnames) }
205 /* DWARF 1.1 and DWARF 2 */
206 .debug_aranges 0 : { *(.debug_aranges) }
207 .debug_pubnames 0 : { *(.debug_pubnames) }
208 /* DWARF 2 */
209 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
210 .debug_abbrev 0 : { *(.debug_abbrev) }
211 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
212 .debug_frame 0 : { *(.debug_frame) }
213 .debug_str 0 : { *(.debug_str) }
214 .debug_loc 0 : { *(.debug_loc) }
215 .debug_macinfo 0 : { *(.debug_macinfo) }
216 /* SGI/MIPS DWARF 2 extensions */
217 .debug_weaknames 0 : { *(.debug_weaknames) }
218 .debug_funcnames 0 : { *(.debug_funcnames) }
219 .debug_typenames 0 : { *(.debug_typenames) }
220 .debug_varnames 0 : { *(.debug_varnames) }
221 /* DWARF 3 */
222 .debug_pubtypes 0 : { *(.debug_pubtypes) }
223 .debug_ranges 0 : { *(.debug_ranges) }
224 /* DWARF Extension. */
225 .debug_macro 0 : { *(.debug_macro) }
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700226 .debug_addr 0 : { *(.debug_addr) }
Rong Xu90135de2014-09-05 14:09:07 -0700227 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
228 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
Rahul Chaudhrybf4b3662017-09-18 10:30:32 -0700229 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
Rong Xu90135de2014-09-05 14:09:07 -0700230}