blob: 5387477e83a186726b67f292b788fbe836dc5bce [file] [log] [blame]
Ben Cheng7823f2a2014-04-08 14:53:42 -07001/* Script for --shared -z combreloc: shared library, combine & sort relocs */
2OUTPUT_FORMAT("elf32-bigarm", "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.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 .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 adjust up to
95 the same address within the page on the next page up. */
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 .preinit_array :
105 {
106 KEEP (*(.preinit_array))
107 }
108 .init_array :
109 {
110 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
111 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
112 }
113 .fini_array :
114 {
115 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
116 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
117 }
118 .ctors :
119 {
120 /* gcc uses crtbegin.o to find the start of
121 the constructors, so we make sure it is
122 first. Because this is a wildcard, it
123 doesn't matter if the user does not
124 actually link against crtbegin.o; the
125 linker won't look for a file to match a
126 wildcard. The wildcard also means that it
127 doesn't matter which directory crtbegin.o
128 is in. */
129 KEEP (*crtbegin.o(.ctors))
130 KEEP (*crtbegin?.o(.ctors))
131 /* We don't want to include the .ctor section from
132 the crtend.o file until after the sorted ctors.
133 The .ctor section from the crtend file contains the
134 end of ctors marker and it must be last */
135 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
136 KEEP (*(SORT(.ctors.*)))
137 KEEP (*(.ctors))
138 }
139 .dtors :
140 {
141 KEEP (*crtbegin.o(.dtors))
142 KEEP (*crtbegin?.o(.dtors))
143 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
144 KEEP (*(SORT(.dtors.*)))
145 KEEP (*(.dtors))
146 }
147 .jcr : { KEEP (*(.jcr)) }
148 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
149 .dynamic : { *(.dynamic) }
150 .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
151 .data :
152 {
153 __data_start = . ;
154 *(.data .data.* .gnu.linkonce.d.*)
155 SORT(CONSTRUCTORS)
156 }
157 .data1 : { *(.data1) }
158 _edata = .; PROVIDE (edata = .);
159 . = .;
160 __bss_start = .;
161 __bss_start__ = .;
162 .bss :
163 {
164 *(.dynbss)
165 *(.bss .bss.* .gnu.linkonce.b.*)
166 *(COMMON)
167 /* Align here to ensure that the .bss section occupies space up to
168 _end. Align after .bss to ensure correct alignment even if the
169 .bss section disappears because there are no input sections.
170 FIXME: Why do we need it? When there is no .bss section, we don't
171 pad the .data section. */
172 . = ALIGN(. != 0 ? 32 / 8 : 1);
173 }
174 _bss_end__ = . ; __bss_end__ = . ;
175 . = ALIGN(32 / 8);
176 . = SEGMENT_START("ldata-segment", .);
177 . = ALIGN(32 / 8);
178 __end__ = . ;
179 _end = .; PROVIDE (end = .);
180 /* Stabs debugging sections. */
181 .stab 0 : { *(.stab) }
182 .stabstr 0 : { *(.stabstr) }
183 .stab.excl 0 : { *(.stab.excl) }
184 .stab.exclstr 0 : { *(.stab.exclstr) }
185 .stab.index 0 : { *(.stab.index) }
186 .stab.indexstr 0 : { *(.stab.indexstr) }
187 .comment 0 : { *(.comment) }
188 /* DWARF debug sections.
189 Symbols in the DWARF debugging sections are relative to the beginning
190 of the section so we begin them at 0. */
191 /* DWARF 1 */
192 .debug 0 : { *(.debug) }
193 .line 0 : { *(.line) }
194 /* GNU DWARF 1 extensions */
195 .debug_srcinfo 0 : { *(.debug_srcinfo) }
196 .debug_sfnames 0 : { *(.debug_sfnames) }
197 /* DWARF 1.1 and DWARF 2 */
198 .debug_aranges 0 : { *(.debug_aranges) }
199 .debug_pubnames 0 : { *(.debug_pubnames) }
200 /* DWARF 2 */
201 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
202 .debug_abbrev 0 : { *(.debug_abbrev) }
203 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
204 .debug_frame 0 : { *(.debug_frame) }
205 .debug_str 0 : { *(.debug_str) }
206 .debug_loc 0 : { *(.debug_loc) }
207 .debug_macinfo 0 : { *(.debug_macinfo) }
208 /* SGI/MIPS DWARF 2 extensions */
209 .debug_weaknames 0 : { *(.debug_weaknames) }
210 .debug_funcnames 0 : { *(.debug_funcnames) }
211 .debug_typenames 0 : { *(.debug_typenames) }
212 .debug_varnames 0 : { *(.debug_varnames) }
213 /* DWARF 3 */
214 .debug_pubtypes 0 : { *(.debug_pubtypes) }
215 .debug_ranges 0 : { *(.debug_ranges) }
216 /* DWARF Extension. */
217 .debug_macro 0 : { *(.debug_macro) }
218 .stack 0x80000 :
219 {
220 _stack = .;
221 *(.stack)
222 }
223 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
224 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
225 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
226}