Merge "rust: Pass ASAN/HWASAN flags alongside fuzzers" into main
This commit is contained in:
@@ -223,11 +223,16 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags, deps PathDeps) (
|
|||||||
if !sanitize.Properties.SanitizerEnabled {
|
if !sanitize.Properties.SanitizerEnabled {
|
||||||
return flags, deps
|
return flags, deps
|
||||||
}
|
}
|
||||||
|
|
||||||
if Bool(sanitize.Properties.Sanitize.Fuzzer) {
|
if Bool(sanitize.Properties.Sanitize.Fuzzer) {
|
||||||
flags.RustFlags = append(flags.RustFlags, fuzzerFlags...)
|
flags.RustFlags = append(flags.RustFlags, fuzzerFlags...)
|
||||||
} else if Bool(sanitize.Properties.Sanitize.Hwaddress) {
|
}
|
||||||
|
|
||||||
|
if Bool(sanitize.Properties.Sanitize.Hwaddress) {
|
||||||
flags.RustFlags = append(flags.RustFlags, hwasanFlags...)
|
flags.RustFlags = append(flags.RustFlags, hwasanFlags...)
|
||||||
} else if Bool(sanitize.Properties.Sanitize.Address) {
|
}
|
||||||
|
|
||||||
|
if Bool(sanitize.Properties.Sanitize.Address) {
|
||||||
flags.RustFlags = append(flags.RustFlags, asanFlags...)
|
flags.RustFlags = append(flags.RustFlags, asanFlags...)
|
||||||
}
|
}
|
||||||
return flags, deps
|
return flags, deps
|
||||||
@@ -267,14 +272,12 @@ func rustSanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
var depTag blueprint.DependencyTag
|
var depTag blueprint.DependencyTag
|
||||||
var deps []string
|
var deps []string
|
||||||
|
|
||||||
if mod.IsSanitizerEnabled(cc.Asan) ||
|
if mod.IsSanitizerEnabled(cc.Asan) {
|
||||||
(mod.IsSanitizerEnabled(cc.Fuzzer) && (mctx.Arch().ArchType != android.Arm64 || !mctx.Os().Bionic())) {
|
|
||||||
variations = append(variations,
|
variations = append(variations,
|
||||||
blueprint.Variation{Mutator: "link", Variation: "shared"})
|
blueprint.Variation{Mutator: "link", Variation: "shared"})
|
||||||
depTag = cc.SharedDepTag()
|
depTag = cc.SharedDepTag()
|
||||||
deps = []string{config.LibclangRuntimeLibrary(mod.toolchain(mctx), "asan")}
|
deps = []string{config.LibclangRuntimeLibrary(mod.toolchain(mctx), "asan")}
|
||||||
} else if mod.IsSanitizerEnabled(cc.Hwasan) ||
|
} else if mod.IsSanitizerEnabled(cc.Hwasan) {
|
||||||
(mod.IsSanitizerEnabled(cc.Fuzzer) && mctx.Arch().ArchType == android.Arm64 && mctx.Os().Bionic()) {
|
|
||||||
// TODO(b/204776996): 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, ok := mod.compiler.(binaryInterface); ok {
|
||||||
if binary.staticallyLinked() {
|
if binary.staticallyLinked() {
|
||||||
|
Reference in New Issue
Block a user