Limit propagating san config of shared to fuzzer
Prior to refactoring the sanitizers to use transition mutators, only
fuzzer sanitizer propagated configuration to shared dependencies
https://android-review.googlesource.com/c/platform/build/soong/+/2123434/9/cc/sanitize.go#b1365
However, this expanded to include TSAN in the refactoring
https://android-review.googlesource.com/c/platform/build/soong/+/2123434/9/cc/sanitize.go#1068.
Fortunately, TSAN is never enabled via Android.bp files in AOSP, so
there was no regression, but we should restore to the prevous state.
Test: go tests
Change-Id: I1a5ad8d033f7a9b4f7578393a2eac7c9362ab6f7
diff --git a/cc/sanitize.go b/cc/sanitize.go
index d3fc221..f39781b 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -171,6 +171,20 @@
}
}
+// shouldPropagateToSharedLibraryDeps returns whether a sanitizer type should propagate to share
+// dependencies. In most cases, sanitizers only propagate to static dependencies; however, some
+// sanitizers also must be enabled for shared libraries for linking.
+func (t SanitizerType) shouldPropagateToSharedLibraryDeps() bool {
+ switch t {
+ case Fuzzer:
+ // Typically, shared libs are not split. However, for fuzzer, we split even for shared libs
+ // because a library sanitized for fuzzer can't be linked from a library that isn't sanitized
+ // for fuzzer.
+ return true
+ default:
+ return false
+ }
+}
func (*Module) SanitizerSupported(t SanitizerType) bool {
switch t {
case Asan:
@@ -1127,7 +1141,8 @@
return s.sanitizer.variationName()
}
- if s.sanitizer == cfi || s.sanitizer == Hwasan || s.sanitizer == scs || s.sanitizer == Asan {
+ // Some sanitizers do not propagate to shared dependencies
+ if !s.sanitizer.shouldPropagateToSharedLibraryDeps() {
return ""
}
}