Merge "rust: Skip global 'fuzzer' sanitizer static bins"

This commit is contained in:
Ivan Lozano 2021-11-15 19:17:54 +00:00 committed by Gerrit Code Review
commit 92a89ed1c5

View file

@ -144,7 +144,7 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
// Global Sanitizers
if found, globalSanitizers = android.RemoveFromList("hwaddress", globalSanitizers); found && s.Hwaddress == nil {
// TODO(b/180495975): HWASan for static Rust binaries isn't supported yet.
// TODO(b/204776996): HWASan for static Rust binaries isn't supported yet.
if !ctx.RustModule().StaticExecutable() {
s.Hwaddress = proptools.BoolPtr(true)
}
@ -161,7 +161,10 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
}
if found, globalSanitizers = android.RemoveFromList("fuzzer", globalSanitizers); found && s.Fuzzer == nil {
s.Fuzzer = proptools.BoolPtr(true)
// TODO(b/204776996): HWASan for static Rust binaries isn't supported yet, and fuzzer enables HWAsan
if !ctx.RustModule().StaticExecutable() {
s.Fuzzer = proptools.BoolPtr(true)
}
}
// Global Diag Sanitizers
@ -287,7 +290,7 @@ func rustSanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
deps = []string{config.LibclangRuntimeLibrary(mod.toolchain(mctx), "asan")}
} else if mod.IsSanitizerEnabled(cc.Hwasan) ||
(mod.IsSanitizerEnabled(cc.Fuzzer) && mctx.Arch().ArchType == android.Arm64) {
// TODO(b/180495975): HWASan for static Rust binaries isn't supported yet.
// TODO(b/204776996): HWASan for static Rust binaries isn't supported yet.
if binary, ok := mod.compiler.(binaryInterface); ok {
if binary.staticallyLinked() {
mctx.ModuleErrorf("HWASan is not supported for static Rust executables yet.")