blob: 6f628fe29dd1bbfad40b258071becf8a93c475c6 [file] [log] [blame]
Ben Cheng7823f2a2014-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)
Ben Cheng7823f2a2014-04-08 14:53:42 -07006SECTIONS
7{
8 /* Read-only sections, merged into text segment: */
Ben Cheng79781f52014-05-19 10:33:46 -07009 . = 0 + SIZEOF_HEADERS;
Ben Cheng7823f2a2014-04-08 14:53:42 -070010 .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*) }
Ben Cheng79781f52014-05-19 10:33:46 -070095 /* Adjust the address for the data segment. For 32 bits we want to align
96 at exactly a page boundary to make life easier for apriori. */
97 . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
Ben Cheng7823f2a2014-04-08 14:53:42 -070098 /* 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) }
Ben Cheng79781f52014-05-19 10:33:46 -0700105 /* Ensure the __preinit_array_start label is properly aligned. We
106 could instead move the label definition inside the section, but
107 the linker would then create the section even if it turns out to
108 be empty, which isn't pretty. */
109 . = ALIGN(32 / 8);
Ben Cheng7823f2a2014-04-08 14:53:42 -0700110 .preinit_array :
111 {
112 KEEP (*(.preinit_array))
113 }
114 .init_array :
115 {
Ben Cheng79781f52014-05-19 10:33:46 -0700116 KEEP (*crtbegin*.o(.init_array))
Ben Cheng7823f2a2014-04-08 14:53:42 -0700117 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
Ben Cheng79781f52014-05-19 10:33:46 -0700118 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .ctors))
Ben Cheng7823f2a2014-04-08 14:53:42 -0700119 }
120 .fini_array :
121 {
Ben Cheng79781f52014-05-19 10:33:46 -0700122 KEEP (*crtbegin*.o(.fini_array))
Ben Cheng7823f2a2014-04-08 14:53:42 -0700123 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
Ben Cheng79781f52014-05-19 10:33:46 -0700124 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .dtors))
Ben Cheng7823f2a2014-04-08 14:53:42 -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))
Ben Cheng79781f52014-05-19 10:33:46 -0700138 KEEP (*crtbegin*.o(.ctors))
Ben Cheng7823f2a2014-04-08 14:53:42 -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 */
Ben Cheng79781f52014-05-19 10:33:46 -0700143 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors))
Ben Cheng7823f2a2014-04-08 14:53:42 -0700144 KEEP (*(SORT(.ctors.*)))
145 KEEP (*(.ctors))
146 }
147 .dtors :
148 {
149 KEEP (*crtbegin.o(.dtors))
Ben Cheng79781f52014-05-19 10:33:46 -0700150 KEEP (*crtbegin*.o(.dtors))
151 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors))
Ben Cheng7823f2a2014-04-08 14:53:42 -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 = .);
168 . = .;
169 __bss_start = .;
170 __bss_start__ = .;
171 .bss :
172 {
173 *(.dynbss)
174 *(.bss .bss.* .gnu.linkonce.b.*)
175 *(COMMON)
176 /* Align here to ensure that the .bss section occupies space up to
177 _end. Align after .bss to ensure correct alignment even if the
Ben Cheng79781f52014-05-19 10:33:46 -0700178 .bss section disappears because there are no input sections. */
179 . = ALIGN(32 / 8);
Ben Cheng7823f2a2014-04-08 14:53:42 -0700180 }
181 _bss_end__ = . ; __bss_end__ = . ;
182 . = ALIGN(32 / 8);
183 . = SEGMENT_START("ldata-segment", .);
184 . = ALIGN(32 / 8);
185 __end__ = . ;
Ben Cheng79781f52014-05-19 10:33:46 -0700186 _end = .;
187 _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
188 PROVIDE (end = .);
Ben Cheng7823f2a2014-04-08 14:53:42 -0700189 . = DATA_SEGMENT_END (.);
190 /* Stabs debugging sections. */
191 .stab 0 : { *(.stab) }
192 .stabstr 0 : { *(.stabstr) }
193 .stab.excl 0 : { *(.stab.excl) }
194 .stab.exclstr 0 : { *(.stab.exclstr) }
195 .stab.index 0 : { *(.stab.index) }
196 .stab.indexstr 0 : { *(.stab.indexstr) }
197 .comment 0 : { *(.comment) }
198 /* DWARF debug sections.
199 Symbols in the DWARF debugging sections are relative to the beginning
200 of the section so we begin them at 0. */
201 /* DWARF 1 */
202 .debug 0 : { *(.debug) }
203 .line 0 : { *(.line) }
204 /* GNU DWARF 1 extensions */
205 .debug_srcinfo 0 : { *(.debug_srcinfo) }
206 .debug_sfnames 0 : { *(.debug_sfnames) }
207 /* DWARF 1.1 and DWARF 2 */
208 .debug_aranges 0 : { *(.debug_aranges) }
209 .debug_pubnames 0 : { *(.debug_pubnames) }
210 /* DWARF 2 */
211 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
212 .debug_abbrev 0 : { *(.debug_abbrev) }
213 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
214 .debug_frame 0 : { *(.debug_frame) }
215 .debug_str 0 : { *(.debug_str) }
216 .debug_loc 0 : { *(.debug_loc) }
217 .debug_macinfo 0 : { *(.debug_macinfo) }
218 /* SGI/MIPS DWARF 2 extensions */
219 .debug_weaknames 0 : { *(.debug_weaknames) }
220 .debug_funcnames 0 : { *(.debug_funcnames) }
221 .debug_typenames 0 : { *(.debug_typenames) }
222 .debug_varnames 0 : { *(.debug_varnames) }
223 /* DWARF 3 */
224 .debug_pubtypes 0 : { *(.debug_pubtypes) }
225 .debug_ranges 0 : { *(.debug_ranges) }
226 /* DWARF Extension. */
227 .debug_macro 0 : { *(.debug_macro) }
228 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
229 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
Ben Cheng79781f52014-05-19 10:33:46 -0700230 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) }
Ben Cheng7823f2a2014-04-08 14:53:42 -0700231}