aboutsummaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorEvgenii Stepanov <eugenis@google.com>2017-06-07 17:48:28 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-06-07 17:48:28 +0000
commit3fd61ab5ee541d1f73370d9f5dbcb91376e45877 (patch)
treefa5f95f7681657dd309787d586628e08b6ef851d /cc
parentf6defdc7b6e277d2d8666da5bf4fa824b022ee52 (diff)
parentfe9bc1dccb6cb8a92d5442c8a93a8f4dc30c2453 (diff)
downloadbuild_soong-3fd61ab5ee541d1f73370d9f5dbcb91376e45877.tar.gz
build_soong-3fd61ab5ee541d1f73370d9f5dbcb91376e45877.tar.bz2
build_soong-3fd61ab5ee541d1f73370d9f5dbcb91376e45877.zip
Fix -fsanitize=integer not passed for soong builds.
am: fe9bc1dccb Change-Id: I517fe3575a2ceb6d68dddcf2640907ac8416fe95
Diffstat (limited to 'cc')
-rw-r--r--cc/sanitize.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 8900ee87..fcb32896 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -212,8 +212,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
}
@@ -308,9 +308,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"
@@ -355,6 +352,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")
}