blob: b48477614bdedeec9a857c9d569ddceb82ba0c17 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001/* Default linker script, for normal executables */
2OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
3 "elf32-littlearm")
4OUTPUT_ARCH(arm)
5ENTRY(_start)
6SEARCH_DIR("/usr/local/armdev/arm-elf/lib");
7/* Do we need any of these for elf?
8 __DYNAMIC = 0; */
9SECTIONS
10{
11 /* Read-only sections, merged into text segment: */
12/* PROVIDE (__executable_start = 0x8000); . = 0x8000; */
13. = 0x8000 + SIZEOF_HEADERS;
14 .interp : { *(.interp) }
15 .hash : { *(.hash) }
16 .dynsym : { *(.dynsym) }
17 .dynstr : { *(.dynstr) }
18 .gnu.version : { *(.gnu.version) }
19 .gnu.version_d : { *(.gnu.version_d) }
20 .gnu.version_r : { *(.gnu.version_r) }
21 .rel.init : { *(.rel.init) }
22 .rela.init : { *(.rela.init) }
23 .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
24 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
25 .rel.fini : { *(.rel.fini) }
26 .rela.fini : { *(.rela.fini) }
27 .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
28 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
29 .rel.data.rel.ro : { *(.rel.data.rel.ro*) }
30 .rela.data.rel.ro : { *(.rel.data.rel.ro*) }
31 .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
32 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
33 .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
34 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
35 .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
36 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
37 .rel.ctors : { *(.rel.ctors) }
38 .rela.ctors : { *(.rela.ctors) }
39 .rel.dtors : { *(.rel.dtors) }
40 .rela.dtors : { *(.rela.dtors) }
41 .rel.got : { *(.rel.got) }
42 .rela.got : { *(.rela.got) }
43 .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
44 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
45 .rel.plt : { *(.rel.plt) }
46 .rela.plt : { *(.rela.plt) }
47 .init :
48 {
49 KEEP (*(.init))
50 } =0
51 .plt : { *(.plt) }
52 .text :
53 {
54 *(.text .stub .text.* .gnu.linkonce.t.*)
55 KEEP (*(.text.*personality*))
56 /* .gnu.warning sections are handled specially by elf32.em. */
57 *(.gnu.warning)
58 *(.glue_7t) *(.glue_7)
59 } =0
60 .fini :
61 {
62 KEEP (*(.fini))
63 } =0
64 PROVIDE (__etext = .);
65 PROVIDE (_etext = .);
66 PROVIDE (etext = .);
67 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
68 .rodata1 : { *(.rodata1) }
69 /* We have to wrap extab and exidx sections with KEEP because we use
70 --gc-sections. */
71 .ARM.extab : { KEEP (*(.ARM.extab* .gnu.linkonce.armextab.*)) }
72 __exidx_start = .;
73 .ARM.exidx : { KEEP (*(.ARM.exidx* .gnu.linkonce.armexidx.*)) }
74 __exidx_end = .;
75 .eh_frame_hdr : { *(.eh_frame_hdr) }
76 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
77 .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
78 /* Adjust the address for the data segment. We want to align at exactly
79 a page boundary to make life easier for apriori. */
80 . = ALIGN(4096);
81 /* Exception handling */
82 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
83 .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) }
84 /* Thread Local Storage sections */
85 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
86 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
87 /* Ensure the __preinit_array_start label is properly aligned. We
88 could instead move the label definition inside the section, but
89 the linker would then create the section even if it turns out to
90 be empty, which isn't pretty. */
91 . = ALIGN(32 / 8);
92 PROVIDE (__preinit_array_start = .);
93 .preinit_array : { KEEP (*(.preinit_array)) }
94 PROVIDE (__preinit_array_end = .);
95 PROVIDE (__init_array_start = .);
Evgeniy Stepanov67772b82012-02-09 19:25:34 +040096 .init_array : {
97 KEEP (*(SORT(.init_array.*)))
98 KEEP (*(.init_array))
99 }
The Android Open Source Project88b60792009-03-03 19:28:42 -0800100 PROVIDE (__init_array_end = .);
101 PROVIDE (__fini_array_start = .);
Evgeniy Stepanov67772b82012-02-09 19:25:34 +0400102 .fini_array : {
103 KEEP (*(.fini_array))
104 KEEP (*(SORT(.fini_array.*)))
105 }
The Android Open Source Project88b60792009-03-03 19:28:42 -0800106 PROVIDE (__fini_array_end = .);
107 .ctors :
108 {
109 /* gcc uses crtbegin.o to find the start of
110 the constructors, so we make sure it is
111 first. Because this is a wildcard, it
112 doesn't matter if the user does not
113 actually link against crtbegin.o; the
114 linker won't look for a file to match a
115 wildcard. The wildcard also means that it
116 doesn't matter which directory crtbegin.o
117 is in. */
118 KEEP (*crtbegin*.o(.ctors))
119 /* We don't want to include the .ctor section from
120 from the crtend.o file until after the sorted ctors.
121 The .ctor section from the crtend file contains the
122 end of ctors marker and it must be last */
123 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
124 KEEP (*(SORT(.ctors.*)))
125 KEEP (*(.ctors))
126 }
127 .dtors :
128 {
129 KEEP (*crtbegin*.o(.dtors))
130 KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
131 KEEP (*(SORT(.dtors.*)))
132 KEEP (*(.dtors))
133 }
134 .jcr : { KEEP (*(.jcr)) }
135 .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
136 .dynamic : { *(.dynamic) }
137 .got : { *(.got.plt) *(.got) }
138 .data :
139 {
140 __data_start = . ;
141 *(.data .data.* .gnu.linkonce.d.*)
142 KEEP (*(.gnu.linkonce.d.*personality*))
143 SORT(CONSTRUCTORS)
144 }
145 .data1 : { *(.data1) }
146 _edata = .;
147 PROVIDE (edata = .);
148 __bss_start = .;
149 __bss_start__ = .;
150 .bss :
151 {
152 *(.dynbss)
153 *(.bss .bss.* .gnu.linkonce.b.*)
154 *(COMMON)
155 /* Align here to ensure that the .bss section occupies space up to
156 _end. Align after .bss to ensure correct alignment even if the
157 .bss section disappears because there are no input sections. */
158 . = ALIGN(32 / 8);
159 }
160 . = ALIGN(32 / 8);
161 _end = .;
162 _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
163 PROVIDE (end = .);
164 /* Stabs debugging sections. */
165 .stab 0 : { *(.stab) }
166 .stabstr 0 : { *(.stabstr) }
167 .stab.excl 0 : { *(.stab.excl) }
168 .stab.exclstr 0 : { *(.stab.exclstr) }
169 .stab.index 0 : { *(.stab.index) }
170 .stab.indexstr 0 : { *(.stab.indexstr) }
171 .comment 0 : { *(.comment) }
172 /* DWARF debug sections.
173 Symbols in the DWARF debugging sections are relative to the beginning
174 of the section so we begin them at 0. */
175 /* DWARF 1 */
176 .debug 0 : { *(.debug) }
177 .line 0 : { *(.line) }
178 /* GNU DWARF 1 extensions */
179 .debug_srcinfo 0 : { *(.debug_srcinfo) }
180 .debug_sfnames 0 : { *(.debug_sfnames) }
181 /* DWARF 1.1 and DWARF 2 */
182 .debug_aranges 0 : { *(.debug_aranges) }
183 .debug_pubnames 0 : { *(.debug_pubnames) }
184 /* DWARF 2 */
185 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
186 .debug_abbrev 0 : { *(.debug_abbrev) }
187 .debug_line 0 : { *(.debug_line) }
188 .debug_frame 0 : { *(.debug_frame) }
189 .debug_str 0 : { *(.debug_str) }
190 .debug_loc 0 : { *(.debug_loc) }
191 .debug_macinfo 0 : { *(.debug_macinfo) }
192 /* SGI/MIPS DWARF 2 extensions */
193 .debug_weaknames 0 : { *(.debug_weaknames) }
194 .debug_funcnames 0 : { *(.debug_funcnames) }
195 .debug_typenames 0 : { *(.debug_typenames) }
196 .debug_varnames 0 : { *(.debug_varnames) }
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -0700197 /* Adding the word ABSOLUTE below, so that the _stack below won't float
198 into a random section. If _stack is not absolutely with .stack section,
199 we saw that sometimes _stack got inserted into the .debug_frame section
200 because it's processed by the linker at that moment. As a result, _stack
201 symbol will get wrongly moved and gelf_update_symshndx() will return
202 invalid data. */
The Android Open Source Project88b60792009-03-03 19:28:42 -0800203 .stack 0x80000 :
204 {
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -0700205 _stack = ABSOLUTE(.);
The Android Open Source Project88b60792009-03-03 19:28:42 -0800206 *(.stack)
207 }
208 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
209 /DISCARD/ : { *(.note.GNU-stack) }
210}