aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2019-10-04 12:40:52 -0700
committerDan Albert <danalbert@google.com>2019-10-04 13:29:26 -0700
commitb1d17d6e31f8fceb4fbe5fbd99aa443d79c77c19 (patch)
tree25c17a7fd99387ae60f63b28339a8bdbfa5b67d9 /build
parentbe4034163b8c0a325b42070c9260a8f205efb2ea (diff)
downloadndk-b1d17d6e31f8fceb4fbe5fbd99aa443d79c77c19.tar.gz
Fix unwinder visibility for most ABIs.
When we switched to using a linker script for libgcc in r19 we broke `-Wl,--exclude-libs,libgcc.a`, because `--exclude-libs` has no effect on the contents of linker scripts. As such, libgcc was not being hidden as expected. The good news is that on the one platform this causes the most trouble (Arm32, since it uses the LLVM unwinder for exception handling rather than libgcc) this didn't cause any issues. Since libunwind was linked first (and the `--exclude-libs` worked there, since the actual library was named), the libgcc unwind symbols did not end up in the output at all. So while this has not caused any issues, it is still a good idea for us to link libgcc hidden to guard against any future unwind ABI breaks. Test: Added a test that checks ndk-build output with readelf Bug: https://github.com/android/ndk/issues/1092 Change-Id: I5c8203afd29f0b7b272a51aadfc1a5ca6cbd33e4
Diffstat (limited to 'build')
-rw-r--r--build/cmake/android.toolchain.cmake2
-rw-r--r--build/core/default-build-commands.mk2
2 files changed, 2 insertions, 2 deletions
diff --git a/build/cmake/android.toolchain.cmake b/build/cmake/android.toolchain.cmake
index 5ad98d95c..9d7e50902 100644
--- a/build/cmake/android.toolchain.cmake
+++ b/build/cmake/android.toolchain.cmake
@@ -347,7 +347,7 @@ if(ANDROID_LD STREQUAL lld)
endif()
# Don't re-export libgcc symbols in every binary.
-list(APPEND ANDROID_LINKER_FLAGS -Wl,--exclude-libs,libgcc.a)
+list(APPEND ANDROID_LINKER_FLAGS -Wl,--exclude-libs,libgcc_real.a)
list(APPEND ANDROID_LINKER_FLAGS -Wl,--exclude-libs,libatomic.a)
# STL.
diff --git a/build/core/default-build-commands.mk b/build/core/default-build-commands.mk
index 4a71f5e0b..138707bdb 100644
--- a/build/core/default-build-commands.mk
+++ b/build/core/default-build-commands.mk
@@ -84,7 +84,7 @@ endef
cmd-strip = $(PRIVATE_STRIP) $(PRIVATE_STRIP_MODE) $(call host-path,$1)
-TARGET_LIBGCC = -lgcc -Wl,--exclude-libs,libgcc.a
+TARGET_LIBGCC = -lgcc -Wl,--exclude-libs,libgcc_real.a
TARGET_LIBATOMIC = -latomic -Wl,--exclude-libs,libatomic.a
TARGET_LDLIBS := -lc -lm