blob: 2b69104f775b6007870338d318eb9e99ea8c8086 [file] [log] [blame]
Ben Cheng09ebc132013-10-18 00:02:49 -07001/* Script for --shared -z combreloc -z now -z relro: 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 .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.dyn :
19 {
20 *(.rel.init)
21 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
22 *(.rel.fini)
23 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
24 *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
25 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
26 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
27 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
28 *(.rel.ctors)
29 *(.rel.dtors)
30 *(.rel.got)
31 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
32 *(.rel.iplt)
33 }
34 .rela.dyn :
35 {
36 *(.rela.init)
37 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
38 *(.rela.fini)
39 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
40 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
41 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
42 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
43 *(.rela.ctors)
44 *(.rela.dtors)
45 *(.rela.got)
46 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
47 *(.rela.iplt)
48 }
49 .rel.plt :
50 {
51 *(.rel.plt)
52 }
53 .rela.plt :
54 {
55 *(.rela.plt)
56 }
57 .init :
58 {
59 KEEP (*(SORT_NONE(.init)))
60 }
61 .plt : { *(.plt) }
62 .iplt : { *(.iplt) }
63 .text :
64 {
65 *(.text.unlikely .text.*_unlikely)
66 *(.text.exit .text.exit.*)
67 *(.text.startup .text.startup.*)
68 *(.text.hot .text.hot.*)
69 *(.text .stub .text.* .gnu.linkonce.t.*)
70 /* .gnu.warning sections are handled specially by elf32.em. */
71 *(.gnu.warning)
72 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
73 }
74 .fini :
75 {
76 KEEP (*(SORT_NONE(.fini)))
77 }
78 PROVIDE (__etext = .);
79 PROVIDE (_etext = .);
80 PROVIDE (etext = .);
81 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
82 .rodata1 : { *(.rodata1) }
83 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
84 PROVIDE_HIDDEN (__exidx_start = .);
85 .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
86 PROVIDE_HIDDEN (__exidx_end = .);
87 .eh_frame_hdr : { *(.eh_frame_hdr) }
88 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
89 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
90 .gcc_except_table.*) }
91 /* These sections are generated by the Sun/Oracle C++ compiler. */
92 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
93 .exception_ranges*) }
94 /* Adjust the address for the data segment. We want to align at exactly
95 a page boundary to make life easier for apriori. */
96 . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));
97 /* Exception handling */
98 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
99 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
100 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
101 /* Thread Local Storage sections */
102 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
103 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
104 /* Ensure the __preinit_array_start label is properly aligned. We
105 could instead move the label definition inside the section, but
106 the linker would then create the section even if it turns out to
107 be empty, which isn't pretty. */
108 . = ALIGN(32 / 8);
109 .preinit_array :
110 {
111 KEEP (*(.preinit_array))
112 }
113 .init_array :
114 {
115 KEEP (*crtbegin*.o(.init_array))
116 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
117 KEEP (*(.init_array))
118 KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
119 }
120 .fini_array :
121 {
122 KEEP (*crtbegin*.o(.fini_array))
123 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
124 KEEP (*(.fini_array))
125 KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
126 }
127 .ctors :
128 {
129 /* gcc uses crtbegin.o to find the start of
130 the constructors, so we make sure it is
131 first. Because this is a wildcard, it
132 doesn't matter if the user does not
133 actually link against crtbegin.o; the
134 linker won't look for a file to match a
135 wildcard. The wildcard also means that it
136 doesn't matter which directory crtbegin.o
137 is in. */
138 KEEP (*crtbegin.o(.ctors))
139 KEEP (*crtbegin*.o(.ctors))
140 /* We don't want to include the .ctor section from
141 the crtend.o file until after the sorted ctors.
142 The .ctor section from the crtend file contains the
143 end of ctors marker and it must be last */
144 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .ctors))
145 KEEP (*(SORT(.ctors.*)))
146 KEEP (*(.ctors))
147 }
148 .dtors :
149 {
150 KEEP (*crtbegin.o(.dtors))
151 KEEP (*crtbegin*.o(.dtors))
152 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend*.o ) .dtors))
153 KEEP (*(SORT(.dtors.*)))
154 KEEP (*(.dtors))
155 }
156 .jcr : { KEEP (*(.jcr)) }
157 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
158 .dynamic : { *(.dynamic) }
159 .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
160 .data :
161 {
162 __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
178 .bss section disappears because there are no input sections. */
179 . = ALIGN(32 / 8);
180 }
181 _bss_end__ = . ; __bss_end__ = . ;
182 . = ALIGN(32 / 8);
183 . = ALIGN(32 / 8);
184 __end__ = . ;
185 _end = .;
186 _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
187 PROVIDE (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) }
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) }
226 .stack 0x80000 :
227 {
228 _stack = .;
229 *(.stack)
230 }
231 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
232 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
233 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) }
234}