aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2018-05-10 14:17:22 -0700
committerIvan Lozano <ivanlozano@google.com>2018-05-16 10:42:39 -0700
commit1838ef9be44938a476a6ecaff153b338e28f8e35 (patch)
tree2c58107422bd6984ed04b186ee0cc3f9a1c87bdd
parent79dff70b468b683fc23fb2e61107a9f69288fee4 (diff)
downloadbuild_soong-1838ef9be44938a476a6ecaff153b338e28f8e35.tar.gz
build_soong-1838ef9be44938a476a6ecaff153b338e28f8e35.tar.bz2
build_soong-1838ef9be44938a476a6ecaff153b338e28f8e35.zip
Don't export UBSan minimal runtime symbols.
When linking in the UBSan minimal runtime, don't export the symbols. This was resulting in an edge case where symbols were sometimes undefined at runtime on address sanitized builds if static library dependencies were integer overflow sanitized. Bug: 78766744 Test: readelf on libraries show either inclusion of the shared library or no undefined symbols related to the minimal runtime. Change-Id: Ide85c8c6b53b400ce9166ccaf96d250797fe4b24 Merged-In: Ide85c8c6b53b400ce9166ccaf96d250797fe4b24 (cherry picked from commit 59fdea2ac2ded9190eaa9ce81252cd809a2985cb)
-rw-r--r--cc/sanitize.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/cc/sanitize.go b/cc/sanitize.go
index ee549bc0..23a7be44 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -300,10 +300,12 @@ func (sanitize *sanitize) deps(ctx BaseModuleContext, deps Deps) Deps {
}
func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
- minimalRuntimePath := "${config.ClangAsanLibDir}/" + config.UndefinedBehaviorSanitizerMinimalRuntimeLibrary(ctx.toolchain()) + ".a"
+ minimalRuntimeLib := config.UndefinedBehaviorSanitizerMinimalRuntimeLibrary(ctx.toolchain()) + ".a"
+ minimalRuntimePath := "${config.ClangAsanLibDir}/" + minimalRuntimeLib
if ctx.Device() && sanitize.Properties.MinimalRuntimeDep {
flags.LdFlags = append(flags.LdFlags, minimalRuntimePath)
+ flags.LdFlags = append(flags.LdFlags, "-Wl,--exclude-libs,"+minimalRuntimeLib)
}
if !sanitize.Properties.SanitizerEnabled {
return flags
@@ -449,6 +451,7 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
if enableMinimalRuntime(sanitize) {
flags.CFlags = append(flags.CFlags, strings.Join(minimalRuntimeFlags, " "))
flags.libFlags = append([]string{minimalRuntimePath}, flags.libFlags...)
+ flags.LdFlags = append(flags.LdFlags, "-Wl,--exclude-libs,"+minimalRuntimeLib)
}
}
}