1- /* This is the standard linker script from NDK version r8b located at
2- <ndk>/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.xsc
3- It has been modified with a rule to place the '.project' section
4- after the .bss section to allow easy insertion of the standalone data. */
5-
61/* Script for --shared -z combreloc: shared library, combine & sort relocs */
72/* Modified for Android. */
3+ /* Copyright (C) 2014 Free Software Foundation, Inc.
4+ Copying and distribution of this script, with or without modification,
5+ are permitted in any medium without royalty provided the copyright
6+ notice and this notice are preserved. */
87OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
98 "elf32-littlearm")
109OUTPUT_ARCH(arm)
@@ -27,7 +26,7 @@ SECTIONS
2726 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
2827 *(.rel.fini)
2928 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
30- *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
29+ *(.rel.data.rel.ro .rel.data.rel.ro. * .rel.gnu.linkonce.d.rel.ro.*)
3130 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
3231 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
3332 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
@@ -62,25 +61,25 @@ SECTIONS
6261 }
6362 .init :
6463 {
65- KEEP (*(.init))
66- } =0
64+ KEEP (*(SORT_NONE( .init) ))
65+ }
6766 .plt : { *(.plt) }
6867 .iplt : { *(.iplt) }
6968 .text :
7069 {
71- *(.text.unlikely .text.*_unlikely)
70+ *(.text.unlikely .text.*_unlikely .text.unlikely.* )
7271 *(.text.exit .text.exit.*)
7372 *(.text.startup .text.startup.*)
7473 *(.text.hot .text.hot.*)
7574 *(.text .stub .text.* .gnu.linkonce.t.*)
7675 /* .gnu.warning sections are handled specially by elf32.em. */
7776 *(.gnu.warning)
7877 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
79- } =0
78+ }
8079 .fini :
8180 {
82- KEEP (*(.fini))
83- } =0
81+ KEEP (*(SORT_NONE( .fini) ))
82+ }
8483 PROVIDE (__etext = .);
8584 PROVIDE (_etext = .);
8685 PROVIDE (etext = .);
@@ -92,13 +91,18 @@ SECTIONS
9291 PROVIDE_HIDDEN (__exidx_end = .);
9392 .eh_frame_hdr : { *(.eh_frame_hdr) }
9493 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
95- .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
96- /* Adjust the address for the data segment. We want to align at exactly
97- a page boundary to make life easier for apriori. */
94+ .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
95+ .gcc_except_table.*) }
96+ /* These sections are generated by the Sun/Oracle C++ compiler. */
97+ .exception_ranges : ONLY_IF_RO { *(.exception_ranges
98+ .exception_ranges*) }
99+ /* Adjust the address for the data segment. For 32 bits we want to align
100+ at exactly a page boundary to make life easier for apriori. */
98101 . = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
99102 /* Exception handling */
100103 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
101104 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
105+ .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
102106 /* Thread Local Storage sections */
103107 .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
104108 .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
@@ -114,14 +118,14 @@ SECTIONS
114118 .init_array :
115119 {
116120 KEEP (*crtbegin*.o(.init_array))
117- KEEP (*(SORT (.init_array.*)))
118- KEEP (*(.init_array))
121+ KEEP (*(SORT_BY_INIT_PRIORITY (.init_array.*) SORT_BY_INIT_PRIORITY(.ctors .*)))
122+ KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .ctors ))
119123 }
120124 .fini_array :
121125 {
122126 KEEP (*crtbegin*.o(.fini_array))
123- KEEP (*(SORT (.fini_array.*)))
124- KEEP (*(.fini_array))
127+ KEEP (*(SORT_BY_INIT_PRIORITY (.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors .*)))
128+ KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .dtors ))
125129 }
126130 .ctors :
127131 {
@@ -153,7 +157,7 @@ SECTIONS
153157 KEEP (*(.dtors))
154158 }
155159 .jcr : { KEEP (*(.jcr)) }
156- .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
160+ .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro. * .gnu.linkonce.d.rel.ro.*) }
157161 .dynamic : { *(.dynamic) }
158162 . = DATA_SEGMENT_RELRO_END (0, .);
159163 .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
@@ -178,9 +182,8 @@ SECTIONS
178182 . = ALIGN(32 / 8);
179183 }
180184 _bss_end__ = . ; __bss_end__ = . ;
181- . = ALIGN(4096);
182- .project : { *(.project) }
183185 . = ALIGN(32 / 8);
186+ . = SEGMENT_START("ldata-segment", .);
184187 . = ALIGN(32 / 8);
185188 __end__ = . ;
186189 _end = .;
@@ -202,27 +205,29 @@ SECTIONS
202205 .debug 0 : { *(.debug) }
203206 .line 0 : { *(.line) }
204207 /* GNU DWARF 1 extensions */
205- .debug_srcinfo 0 : { *(.debug_srcinfo .zdebug_srcinfo ) }
206- .debug_sfnames 0 : { *(.debug_sfnames .zdebug_sfnames ) }
208+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
209+ .debug_sfnames 0 : { *(.debug_sfnames) }
207210 /* DWARF 1.1 and DWARF 2 */
208- .debug_aranges 0 : { *(.debug_aranges .zdebug_aranges ) }
209- .debug_pubnames 0 : { *(.debug_pubnames .zdebug_pubnames ) }
211+ .debug_aranges 0 : { *(.debug_aranges) }
212+ .debug_pubnames 0 : { *(.debug_pubnames) }
210213 /* DWARF 2 */
211- .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.* .zdebug_info ) }
212- .debug_abbrev 0 : { *(.debug_abbrev .zdebug_abbrev ) }
213- .debug_line 0 : { *(.debug_line .zdebug_line ) }
214- .debug_frame 0 : { *(.debug_frame .zdebug_frame ) }
215- .debug_str 0 : { *(.debug_str .zdebug_str ) }
216- .debug_loc 0 : { *(.debug_loc .zdebug_loc ) }
217- .debug_macinfo 0 : { *(.debug_macinfo .zdebug_macinfo ) }
214+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
215+ .debug_abbrev 0 : { *(.debug_abbrev) }
216+ .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
217+ .debug_frame 0 : { *(.debug_frame) }
218+ .debug_str 0 : { *(.debug_str) }
219+ .debug_loc 0 : { *(.debug_loc) }
220+ .debug_macinfo 0 : { *(.debug_macinfo) }
218221 /* SGI/MIPS DWARF 2 extensions */
219- .debug_weaknames 0 : { *(.debug_weaknames .zdebug_weaknames ) }
220- .debug_funcnames 0 : { *(.debug_funcnames .zdebug_funcnames ) }
221- .debug_typenames 0 : { *(.debug_typenames .zdebug_typenames ) }
222- .debug_varnames 0 : { *(.debug_varnames .zdebug_varnames ) }
222+ .debug_weaknames 0 : { *(.debug_weaknames) }
223+ .debug_funcnames 0 : { *(.debug_funcnames) }
224+ .debug_typenames 0 : { *(.debug_typenames) }
225+ .debug_varnames 0 : { *(.debug_varnames) }
223226 /* DWARF 3 */
224- .debug_pubtypes 0 : { *(.debug_pubtypes .zdebug_pubtypes) }
225- .debug_ranges 0 : { *(.debug_ranges .zdebug_ranges) }
227+ .debug_pubtypes 0 : { *(.debug_pubtypes) }
228+ .debug_ranges 0 : { *(.debug_ranges) }
229+ /* DWARF Extension. */
230+ .debug_macro 0 : { *(.debug_macro) }
226231 .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
227232 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
228233 /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) }
0 commit comments