diff options
author | Colin Cross <ccross@android.com> | 2016-07-15 13:10:48 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-07-15 13:12:58 -0700 |
commit | 263abbd5e91cf043b5a8077d1eaa1e0a4a39f5d7 (patch) | |
tree | 3fdfba8833c62672f9d15ff5a49cc4fb442de809 | |
parent | aa3bf3768a2b4ac321584bc1c2a74a6a2e7fde21 (diff) | |
download | build_soong-263abbd5e91cf043b5a8077d1eaa1e0a4a39f5d7.tar.gz build_soong-263abbd5e91cf043b5a8077d1eaa1e0a4a39f5d7.tar.bz2 build_soong-263abbd5e91cf043b5a8077d1eaa1e0a4a39f5d7.zip |
Support global and local sanitizers
Mixing undefined and address sanitizers requires updating cflags.
Matches makefile change Ifee350da4877008fb061bc7f6c700e7fade405bc
Bug: 30163657
Change-Id: Iea4364b912b496400581a475bc79bd9b9c4dd76d
-rw-r--r-- | cc/sanitize.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cc/sanitize.go b/cc/sanitize.go index 76d6618e..172aae74 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -170,10 +170,12 @@ func (sanitize *sanitize) deps(ctx BaseModuleContext, deps Deps) Deps { } if ctx.Device() { - deps.SharedLibs = append(deps.SharedLibs, "libdl") if Bool(sanitize.Properties.Sanitize.Address) { deps.StaticLibs = append(deps.StaticLibs, "libasan") } + if Bool(sanitize.Properties.Sanitize.Address) || Bool(sanitize.Properties.Sanitize.Thread) { + deps.SharedLibs = append(deps.SharedLibs, "libdl") + } } return deps @@ -274,8 +276,9 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags { flags.LdFlags = append(flags.LdFlags, sanitizeArg) flags.LdFlags = append(flags.LdFlags, "-lrt", "-ldl") } else { - if !Bool(sanitize.Properties.Sanitize.Address) { - flags.CFlags = append(flags.CFlags, "-fsanitize-trap=all", "-ftrap-function=abort") + flags.CFlags = append(flags.CFlags, "-fsanitize-trap=all", "-ftrap-function=abort") + if Bool(sanitize.Properties.Sanitize.Address) || Bool(sanitize.Properties.Sanitize.Thread) { + flags.CFlags = append(flags.CFlags, "-fno-sanitize-trap=address,thread") } } } |