diff options
author | 2022-10-04 23:52:48 +0000 | |
---|---|---|
committer | 2022-10-12 19:32:48 +0000 | |
commit | 2bcdf5edd73897b953e2422eadf389773f81c00c (patch) | |
tree | 3dd94a10040a9fcd57612df91d49e477ccd8c03a | |
parent | d201524549b2beef4912800d6d89c5a8a52b2556 (diff) |
[coverage] On coverage+hwasan build, disable hwasan global instrumentation
Bug: http://b/248022906
Bug: http://b/247941801
HWAsan global instrumentation on __llvm_profile_filename causes
duplicate symbol errors when linked together with libraries where hwasan
is disabled. Disable hwasan global instrumentation since those type of
errors are rare.
In the future, we may fix this in llvm to skip hwasan global
instrumentation on symbols added for coverage.
Test: m CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS=* \
SANITIZE_TARGET=hwaddress
Test: Add `hwaddress: true` to libc_defaults; m CLANG_COVERAGE=true
Change-Id: I8506cfd567d212262a2a54b9881a8f64cdbf7a76
-rw-r--r-- | cc/coverage.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cc/coverage.go b/cc/coverage.go index d0902eab8..a7356f879 100644 --- a/cc/coverage.go +++ b/cc/coverage.go @@ -108,6 +108,12 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags if EnableContinuousCoverage(ctx) { flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-mllvm", "-runtime-counter-relocation") } + + // http://b/248022906, http://b/247941801 enabling coverage and hwasan-globals + // instrumentation together causes duplicate-symbol errors for __llvm_profile_filename. + if c, ok := ctx.Module().(*Module); ok && c.sanitize.isSanitizerEnabled(Hwasan) { + flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-mllvm", "-hwasan-globals=0") + } } } |