From c3a1e2206029a77e118da089e3d1a478d863e30f Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Wed, 10 Apr 2019 17:57:50 -0700 Subject: [PATCH] Do not re-export _Unwind_XXX symbols. Bug: 130267141 Test: All system shared libraries do not contain global _Unwind_XXX symbols. Change-Id: I79673753bb8197041bfe8ffb016d9f5fdf4cada5 Merged-In: I79673753bb8197041bfe8ffb016d9f5fdf4cada5 (cherry picked from commit cf788674176513efca5773cea0701e636669a057) --- cc/config/global.go | 1 + cc/stl.go | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cc/config/global.go b/cc/config/global.go index 78f24f2d3..8fc9ff294 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -83,6 +83,7 @@ var ( "-Wl,--warn-shared-textrel", "-Wl,--fatal-warnings", "-Wl,--no-undefined-version", + "-Wl,--exclude-libs,libgcc.a", } deviceGlobalLldflags = append(ClangFilterUnknownLldflags(deviceGlobalLdflags), diff --git a/cc/stl.go b/cc/stl.go index e59f67761..1a5dd79c3 100644 --- a/cc/stl.go +++ b/cc/stl.go @@ -245,7 +245,10 @@ func (stl *stl) flags(ctx ModuleContext, flags Flags) Flags { ndkSrcRoot := android.PathForSource(ctx, "prebuilts/ndk/current/sources/cxx-stl/system/include") flags.CFlags = append(flags.CFlags, "-isystem "+ndkSrcRoot.String()) case "ndk_libc++_shared", "ndk_libc++_static": - // Nothing. + if ctx.Arch().ArchType == android.Arm { + // Make sure the _Unwind_XXX symbols are not re-exported. + flags.LdFlags = append(flags.LdFlags, "-Wl,--exclude-libs,libunwind.a") + } case "": // None or error. if !ctx.toolchain().Bionic() {