aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-08 10:00:20 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-08 10:00:20 +0000
commit08979c7567c5bcc510ff0f42655944fa478b3474 (patch)
tree68da387403e4876fceacef39e8a0fbec57861844
parent1f0b6c8afaa250047d74d092fa6bb75fc455fecf (diff)
parentfe9bc1dccb6cb8a92d5442c8a93a8f4dc30c2453 (diff)
downloadbuild_soong-08979c7567c5bcc510ff0f42655944fa478b3474.tar.gz
build_soong-08979c7567c5bcc510ff0f42655944fa478b3474.tar.bz2
build_soong-08979c7567c5bcc510ff0f42655944fa478b3474.zip
release-request-011e6329-d82e-4e46-980f-68776b0cd6b9-for-git_oc-release-4080367 snap-temp-L79900000072116775
Change-Id: Iac74049e560a09401d11e9016633a0aec1a74493
-rw-r--r--cc/sanitize.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 18d6c16e..0ccde976 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -203,8 +203,8 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
// TODO(ccross): error for compile_multilib = "32"?
}
- if Bool(s.All_undefined) || Bool(s.Undefined) || Bool(s.Address) ||
- Bool(s.Thread) || Bool(s.Coverage) || Bool(s.Safestack) || Bool(s.Cfi) {
+ if ctx.Os() != android.Windows && (Bool(s.All_undefined) || Bool(s.Undefined) || Bool(s.Address) || Bool(s.Thread) ||
+ Bool(s.Coverage) || Bool(s.Safestack) || Bool(s.Cfi) || len(s.Misc_undefined) > 0) {
sanitize.Properties.SanitizerEnabled = true
}
@@ -299,9 +299,6 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
// libraries needed with -fsanitize=address. http://b/18650275 (WAI)
flags.LdFlags = append(flags.LdFlags, "-lm", "-lpthread")
flags.LdFlags = append(flags.LdFlags, "-Wl,--no-as-needed")
- // Host ASAN only links symbols in the final executable, so
- // there will always be undefined symbols in intermediate libraries.
- _, flags.LdFlags = removeFromList("-Wl,--no-undefined", flags.LdFlags)
} else {
flags.CFlags = append(flags.CFlags, "-mllvm", "-asan-globals=0")
flags.DynamicLinker = "/system/bin/linker_asan"
@@ -351,6 +348,9 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
flags.CFlags = append(flags.CFlags, "-fno-sanitize-recover=all")
flags.LdFlags = append(flags.LdFlags, sanitizeArg)
flags.LdFlags = append(flags.LdFlags, "-lrt", "-ldl")
+ // Host sanitizers only link symbols in the final executable, so
+ // there will always be undefined symbols in intermediate libraries.
+ _, flags.LdFlags = removeFromList("-Wl,--no-undefined", flags.LdFlags)
} else {
flags.CFlags = append(flags.CFlags, "-fsanitize-trap=all", "-ftrap-function=abort")
}