From 3c344ef29e360ad7dff3ec749b9c66381f297467 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 18 Jul 2016 15:44:56 -0700 Subject: [PATCH] Disable asan for static binaries build/core/executable.mk has an extra check to disable asan for static binaries, do the same in soong. Bug: 30191800 Change-Id: Ia78063264f3280eb889ba9e45c45dd66e4c64a96 --- cc/sanitize.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cc/sanitize.go b/cc/sanitize.go index 172aae748..08ffff422 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -141,9 +141,10 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) { ctx.ModuleErrorf("unknown global sanitizer option %s", globalSanitizers[0]) } } - if Bool(s.All_undefined) || Bool(s.Undefined) || Bool(s.Address) || - Bool(s.Thread) || Bool(s.Coverage) || Bool(s.Safestack) { - sanitize.Properties.SanitizerEnabled = true + + if ctx.staticBinary() { + s.Address = nil + s.Thread = nil } if Bool(s.All_undefined) { @@ -157,6 +158,11 @@ 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) { + sanitize.Properties.SanitizerEnabled = true + } + if Bool(s.Coverage) { if !Bool(s.Address) { ctx.ModuleErrorf(`Use of "coverage" also requires "address"`)