Disable global coverage when a module disables asan.
With SANITIZE_TARGET="address coverage", if a module disables ASan
(address: false), it is left with just coverage, which is not
supported. In that case, disable coverage as well.
Bug: 33091541
Test: see above
Change-Id: Idcd04dad8cab7c7e2644d2408b1b8a381490e5af
diff --git a/cc/sanitize.go b/cc/sanitize.go
index dca58d8..79c86aa 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -136,8 +136,14 @@
s.Undefined = boolPtr(true)
}
- if found, globalSanitizers = removeFromList("address", globalSanitizers); found && s.Address == nil {
- s.Address = boolPtr(true)
+ if found, globalSanitizers = removeFromList("address", globalSanitizers); found {
+ if s.Address == nil {
+ s.Address = boolPtr(true)
+ } else if *s.Address == false {
+ // Coverage w/o address is an error. If globalSanitizers includes both, and the module
+ // disables address, then disable coverage as well.
+ _, globalSanitizers = removeFromList("coverage", globalSanitizers)
+ }
}
if found, globalSanitizers = removeFromList("thread", globalSanitizers); found && s.Thread == nil {