From 64bee4decfc317af8c6326a9c4ca8ea6a0fce53d Mon Sep 17 00:00:00 2001 From: Evgenii Stepanov Date: Fri, 22 Nov 2019 18:37:10 -0800 Subject: [PATCH] Add -instcombine-lower-dbg-declare to hwasan flags. This is a workaround to improve hwasan reports involving stack variables. Bug: 112437883 Test: SANITIZE_TARGET=hwaddress, build and boot Change-Id: I21ea2fdd2d1f04e2bb9b9847785c00a951030c74 --- cc/sanitize.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cc/sanitize.go b/cc/sanitize.go index 2bf051e5a..25dcafe52 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -39,7 +39,16 @@ var ( hwasanCflags = []string{"-fno-omit-frame-pointer", "-Wno-frame-larger-than=", "-fsanitize-hwaddress-abi=platform", - "-fno-experimental-new-pass-manager"} + "-fno-experimental-new-pass-manager", + // The following improves debug location information + // availability at the cost of its accuracy. It increases + // the likelihood of a stack variable's frame offset + // to be recorded in the debug info, which is important + // for the quality of hwasan reports. The downside is a + // higher number of "optimized out" stack variables. + // b/112437883. + "-mllvm", "-instcombine-lower-dbg-declare=0", + } cfiCflags = []string{"-flto", "-fsanitize-cfi-cross-dso", "-fsanitize-blacklist=external/compiler-rt/lib/cfi/cfi_blacklist.txt"}