summaryrefslogtreecommitdiffstats
path: root/binutils-2.24
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-04-30 11:56:57 -0700
committerAndrew Hsieh <andrewhsieh@google.com>2014-05-01 15:03:06 -0700
commite0bca373a85fa71b89d9ea42370433b3c0499b9d (patch)
treed15ba36a2ffd7e1eea76bd1b8540acb120986b92 /binutils-2.24
parent57fbbfbda5a77b558c24a44e7eed8c4030c31bcd (diff)
downloadtoolchain_binutils-e0bca373a85fa71b89d9ea42370433b3c0499b9d.zip
toolchain_binutils-e0bca373a85fa71b89d9ea42370433b3c0499b9d.tar.gz
toolchain_binutils-e0bca373a85fa71b89d9ea42370433b3c0499b9d.tar.bz2
[2.24] fix MIPS static executable segfault
Previous commit f25603579c0a04b3d5099259cf54c5b3c8775b78 isn't complete because .ctors/.dtors in crtbegin*/crtend* aren't excluded from .init_array/.fini_array. Static executable (eg. $NDK/tests/device/static-executable) causes "Bus Error" because call_array() in __libc_init() call ffffffff from __INIT_ARRAY__ not properly terminaed by NULL. Disassembly of section .init_array: 000b42ac <__INIT_ARRAY__>: b42ac: ff ff ff ff 000b42b0 <__CTOR_LIST__>: b42b0: ff ff ff ff dc 09 08 00 f8 09 08 00 00 00 00 00 000b42c0 <__CTOR_END__>: b42c0: 00 00 00 00 Note that Android uses .init/.fini_array (move away from .ctors/.dtors), but we can't simply remove _CTOR* from crtbegin_static/dynamic.o because older device (eg. ICS) call_array() on CTOR_LIST The correct fix is to exclude them Thanks to icebergfu@gmail.com for identifying the issues. Change-Id: I7a955753baa00fd486cc5a37362ab91c3a21d1e1
Diffstat (limited to 'binutils-2.24')
-rw-r--r--binutils-2.24/ld/scripttempl/elf.sc4
1 files changed, 2 insertions, 2 deletions
diff --git a/binutils-2.24/ld/scripttempl/elf.sc b/binutils-2.24/ld/scripttempl/elf.sc
index 330bddc..b1e6906 100644
--- a/binutils-2.24/ld/scripttempl/elf.sc
+++ b/binutils-2.24/ld/scripttempl/elf.sc
@@ -240,8 +240,8 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
- CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors"
- DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors"
+ CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o $OTHER_EXCLUDE_FILES) .ctors"
+ DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin*.o *crtend.o *crtend*.o $OTHER_EXCLUDE_FILES) .dtors"
else
SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"