blob: fd6aa321f9a486a4c79846e6d43f1fe05d24c363 [file] [log] [blame]
Ben Cheng6e5a1b62014-04-08 14:53:42 -07001/* Script for ld --shared: link shared library */
2OUTPUT_FORMAT("elf64-bigaarch64", "elf64-bigaarch64",
3 "elf64-littleaarch64")
4OUTPUT_ARCH(aarch64)
5ENTRY(_start)
6SEARCH_DIR("/tmp/toolchain-build-aarch64-linux-4.9/prefix/aarch64-linux-android/lib64"); SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
7SECTIONS
8{
9 /* Read-only sections, merged into text segment: */
10 . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
11 .note.gnu.build-id : { *(.note.gnu.build-id) }
12 .hash : { *(.hash) }
13 .gnu.hash : { *(.gnu.hash) }
14 .dynsym : { *(.dynsym) }
15 .dynstr : { *(.dynstr) }
16 .gnu.version : { *(.gnu.version) }
17 .gnu.version_d : { *(.gnu.version_d) }
18 .gnu.version_r : { *(.gnu.version_r) }
19 .rela.init : { *(.rela.init) }
20 .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
21 .rela.fini : { *(.rela.fini) }
22 .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
23 .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
24 .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
25 .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
26 .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
27 .rela.ctors : { *(.rela.ctors) }
28 .rela.dtors : { *(.rela.dtors) }
29 .rela.got : { *(.rela.got) }
30 .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
31 .rela.ifunc : { *(.rela.ifunc) }
32 .rela.plt :
33 {
34 *(.rela.plt)
35 *(.rela.iplt)
36 }
37 .init :
38 {
39 KEEP (*(SORT_NONE(.init)))
40 } =0
41 .plt : ALIGN(16) { *(.plt) *(.iplt) }
42 .text :
43 {
44 *(.text.unlikely .text.*_unlikely .text.unlikely.*)
45 *(.text.exit .text.exit.*)
46 *(.text.startup .text.startup.*)
47 *(.text.hot .text.hot.*)
48 *(.text .stub .text.* .gnu.linkonce.t.*)
49 /* .gnu.warning sections are handled specially by elf32.em. */
50 *(.gnu.warning)
51 } =0
52 .fini :
53 {
54 KEEP (*(SORT_NONE(.fini)))
55 } =0
56 PROVIDE (__etext = .);
57 PROVIDE (_etext = .);
58 PROVIDE (etext = .);
59 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
60 .rodata1 : { *(.rodata1) }
61 .eh_frame_hdr : { *(.eh_frame_hdr) }
62 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
63 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
64 .gcc_except_table.*) }
65 /* These sections are generated by the Sun/Oracle C++ compiler. */
66 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
67 .exception_ranges*) }
68 /* Adjust the address for the data segment. We want to adjust up to
69 the same address within the page on the next page up. */
70 . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
71 /* Exception handling */
72 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
73 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
74 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
75 /* Thread Local Storage sections */
76 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
77 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
78 .preinit_array :
79 {
80 KEEP (*(.preinit_array))
81 }
82 .init_array :
83 {
84 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
85 KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
86 }
87 .fini_array :
88 {
89 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
90 KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
91 }
92 .ctors :
93 {
94 /* gcc uses crtbegin.o to find the start of
95 the constructors, so we make sure it is
96 first. Because this is a wildcard, it
97 doesn't matter if the user does not
98 actually link against crtbegin.o; the
99 linker won't look for a file to match a
100 wildcard. The wildcard also means that it
101 doesn't matter which directory crtbegin.o
102 is in. */
103 KEEP (*crtbegin.o(.ctors))
104 KEEP (*crtbegin?.o(.ctors))
105 /* We don't want to include the .ctor section from
106 the crtend.o file until after the sorted ctors.
107 The .ctor section from the crtend file contains the
108 end of ctors marker and it must be last */
109 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
110 KEEP (*(SORT(.ctors.*)))
111 KEEP (*(.ctors))
112 }
113 .dtors :
114 {
115 KEEP (*crtbegin.o(.dtors))
116 KEEP (*crtbegin?.o(.dtors))
117 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
118 KEEP (*(SORT(.dtors.*)))
119 KEEP (*(.dtors))
120 }
121 .jcr : { KEEP (*(.jcr)) }
122 .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
123 .dynamic : { *(.dynamic) }
124 .got : { *(.got) *(.igot) }
125 . = DATA_SEGMENT_RELRO_END (24, .);
126 .got.plt : { *(.got.plt) *(.igot.plt) }
127 .data :
128 {
129 PROVIDE (__data_start = .);
130 *(.data .data.* .gnu.linkonce.d.*)
131 SORT(CONSTRUCTORS)
132 }
133 .data1 : { *(.data1) }
134 _edata = .; PROVIDE (edata = .);
135 . = .;
136 __bss_start = .;
137 __bss_start__ = .;
138 .bss :
139 {
140 *(.dynbss)
141 *(.bss .bss.* .gnu.linkonce.b.*)
142 *(COMMON)
143 /* Align here to ensure that the .bss section occupies space up to
144 _end. Align after .bss to ensure correct alignment even if the
145 .bss section disappears because there are no input sections.
146 FIXME: Why do we need it? When there is no .bss section, we don't
147 pad the .data section. */
148 . = ALIGN(. != 0 ? 64 / 8 : 1);
149 }
150 _bss_end__ = . ; __bss_end__ = . ;
151 . = ALIGN(64 / 8);
152 . = SEGMENT_START("ldata-segment", .);
153 . = ALIGN(64 / 8);
154 __end__ = . ;
155 _end = .; PROVIDE (end = .);
156 . = DATA_SEGMENT_END (.);
157 /* Stabs debugging sections. */
158 .stab 0 : { *(.stab) }
159 .stabstr 0 : { *(.stabstr) }
160 .stab.excl 0 : { *(.stab.excl) }
161 .stab.exclstr 0 : { *(.stab.exclstr) }
162 .stab.index 0 : { *(.stab.index) }
163 .stab.indexstr 0 : { *(.stab.indexstr) }
164 .comment 0 : { *(.comment) }
165 /* DWARF debug sections.
166 Symbols in the DWARF debugging sections are relative to the beginning
167 of the section so we begin them at 0. */
168 /* DWARF 1 */
169 .debug 0 : { *(.debug) }
170 .line 0 : { *(.line) }
171 /* GNU DWARF 1 extensions */
172 .debug_srcinfo 0 : { *(.debug_srcinfo) }
173 .debug_sfnames 0 : { *(.debug_sfnames) }
174 /* DWARF 1.1 and DWARF 2 */
175 .debug_aranges 0 : { *(.debug_aranges) }
176 .debug_pubnames 0 : { *(.debug_pubnames) }
177 /* DWARF 2 */
178 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
179 .debug_abbrev 0 : { *(.debug_abbrev) }
180 .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
181 .debug_frame 0 : { *(.debug_frame) }
182 .debug_str 0 : { *(.debug_str) }
183 .debug_loc 0 : { *(.debug_loc) }
184 .debug_macinfo 0 : { *(.debug_macinfo) }
185 /* SGI/MIPS DWARF 2 extensions */
186 .debug_weaknames 0 : { *(.debug_weaknames) }
187 .debug_funcnames 0 : { *(.debug_funcnames) }
188 .debug_typenames 0 : { *(.debug_typenames) }
189 .debug_varnames 0 : { *(.debug_varnames) }
190 /* DWARF 3 */
191 .debug_pubtypes 0 : { *(.debug_pubtypes) }
192 .debug_ranges 0 : { *(.debug_ranges) }
193 /* DWARF Extension. */
194 .debug_macro 0 : { *(.debug_macro) }
195 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
196 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
197 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
198}