Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit f62ea2c

Browse files
authored
Merge pull request #5449 from livecodeali/bugfix-android_linker_script
[[ Android ]] Update linker script for ndk r14
2 parents e7c3835 + f46ef6f commit f62ea2c

1 file changed

Lines changed: 46 additions & 34 deletions

File tree

engine/standalone-android.link

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
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
1+
/* This is the standard linker script from NDK version r14b located at
2+
<ndk>/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.xsc
33
It has been modified with a rule to place the '.project' section
44
after the .bss section to allow easy insertion of the standalone data. */
55

66
/* Script for --shared -z combreloc: shared library, combine & sort relocs */
77
/* Modified for Android. */
8+
/* Copyright (C) 2014 Free Software Foundation, Inc.
9+
Copying and distribution of this script, with or without modification,
10+
are permitted in any medium without royalty provided the copyright
11+
notice and this notice are preserved. */
812
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
913
"elf32-littlearm")
1014
OUTPUT_ARCH(arm)
@@ -27,7 +31,7 @@ SECTIONS
2731
*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
2832
*(.rel.fini)
2933
*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
30-
*(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
34+
*(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
3135
*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
3236
*(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
3337
*(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
@@ -63,24 +67,24 @@ SECTIONS
6367
.init :
6468
{
6569
KEEP (*(.init))
66-
} =0
70+
}
6771
.plt : { *(.plt) }
6872
.iplt : { *(.iplt) }
6973
.text :
7074
{
71-
*(.text.unlikely .text.*_unlikely)
75+
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
7276
*(.text.exit .text.exit.*)
7377
*(.text.startup .text.startup.*)
7478
*(.text.hot .text.hot.*)
7579
*(.text .stub .text.* .gnu.linkonce.t.*)
7680
/* .gnu.warning sections are handled specially by elf32.em. */
7781
*(.gnu.warning)
7882
*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
79-
} =0
83+
}
8084
.fini :
8185
{
8286
KEEP (*(.fini))
83-
} =0
87+
}
8488
PROVIDE (__etext = .);
8589
PROVIDE (_etext = .);
8690
PROVIDE (etext = .);
@@ -92,13 +96,18 @@ SECTIONS
9296
PROVIDE_HIDDEN (__exidx_end = .);
9397
.eh_frame_hdr : { *(.eh_frame_hdr) }
9498
.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. */
99+
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
100+
.gcc_except_table.*) }
101+
/* These sections are generated by the Sun/Oracle C++ compiler. */
102+
.exception_ranges : ONLY_IF_RO { *(.exception_ranges
103+
.exception_ranges*) }
104+
/* Adjust the address for the data segment. For 32 bits we want to align
105+
at exactly a page boundary to make life easier for apriori. */
98106
. = ALIGN (CONSTANT (MAXPAGESIZE)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
99107
/* Exception handling */
100108
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
101109
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
110+
.exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
102111
/* Thread Local Storage sections */
103112
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
104113
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
@@ -114,14 +123,14 @@ SECTIONS
114123
.init_array :
115124
{
116125
KEEP (*crtbegin*.o(.init_array))
117-
KEEP (*(SORT(.init_array.*)))
118-
KEEP (*(.init_array))
126+
KEEP (*(SORT(.init_array.*) SORT(.ctors.*)))
127+
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .ctors))
119128
}
120129
.fini_array :
121130
{
122131
KEEP (*crtbegin*.o(.fini_array))
123-
KEEP (*(SORT(.fini_array.*)))
124-
KEEP (*(.fini_array))
132+
KEEP (*(SORT(.fini_array.*) SORT(.dtors.*)))
133+
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o ) .dtors))
125134
}
126135
.ctors :
127136
{
@@ -153,7 +162,7 @@ SECTIONS
153162
KEEP (*(.dtors))
154163
}
155164
.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.*) }
165+
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
157166
.dynamic : { *(.dynamic) }
158167
. = DATA_SEGMENT_RELRO_END (0, .);
159168
.got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
@@ -178,10 +187,11 @@ SECTIONS
178187
. = ALIGN(32 / 8);
179188
}
180189
_bss_end__ = . ; __bss_end__ = . ;
181-
. = ALIGN(4096);
182-
.project : { *(.project) }
183190
. = ALIGN(32 / 8);
191+
. = SEGMENT_START("ldata-segment", .);
184192
. = ALIGN(32 / 8);
193+
. = ALIGN(4096);
194+
.project : { *(.project) }
185195
__end__ = . ;
186196
_end = .;
187197
_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
@@ -202,27 +212,29 @@ SECTIONS
202212
.debug 0 : { *(.debug) }
203213
.line 0 : { *(.line) }
204214
/* GNU DWARF 1 extensions */
205-
.debug_srcinfo 0 : { *(.debug_srcinfo .zdebug_srcinfo) }
206-
.debug_sfnames 0 : { *(.debug_sfnames .zdebug_sfnames) }
215+
.debug_srcinfo 0 : { *(.debug_srcinfo) }
216+
.debug_sfnames 0 : { *(.debug_sfnames) }
207217
/* DWARF 1.1 and DWARF 2 */
208-
.debug_aranges 0 : { *(.debug_aranges .zdebug_aranges) }
209-
.debug_pubnames 0 : { *(.debug_pubnames .zdebug_pubnames) }
218+
.debug_aranges 0 : { *(.debug_aranges) }
219+
.debug_pubnames 0 : { *(.debug_pubnames) }
210220
/* 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) }
221+
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
222+
.debug_abbrev 0 : { *(.debug_abbrev) }
223+
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
224+
.debug_frame 0 : { *(.debug_frame) }
225+
.debug_str 0 : { *(.debug_str) }
226+
.debug_loc 0 : { *(.debug_loc) }
227+
.debug_macinfo 0 : { *(.debug_macinfo) }
218228
/* 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) }
229+
.debug_weaknames 0 : { *(.debug_weaknames) }
230+
.debug_funcnames 0 : { *(.debug_funcnames) }
231+
.debug_typenames 0 : { *(.debug_typenames) }
232+
.debug_varnames 0 : { *(.debug_varnames) }
223233
/* DWARF 3 */
224-
.debug_pubtypes 0 : { *(.debug_pubtypes .zdebug_pubtypes) }
225-
.debug_ranges 0 : { *(.debug_ranges .zdebug_ranges) }
234+
.debug_pubtypes 0 : { *(.debug_pubtypes) }
235+
.debug_ranges 0 : { *(.debug_ranges) }
236+
/* DWARF Extension. */
237+
.debug_macro 0 : { *(.debug_macro) }
226238
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
227239
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
228240
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.mdebug.*) }

0 commit comments

Comments
 (0)