Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57246646 authored by Ivan Lozano's avatar Ivan Lozano Committed by Automerger Merge Worker
Browse files

Merge "rust: Skip global 'fuzzer' sanitizer static bins" am: 92a89ed1

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1892595

Change-Id: I8d2e59692d6fb99fea29dc8242de0747909fc23f
parents e25e4295 92a89ed1
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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,8 +161,11 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
		}

		if found, globalSanitizers = android.RemoveFromList("fuzzer", globalSanitizers); found && s.Fuzzer == nil {
			// 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
		if found, globalSanitizersDiag = android.RemoveFromList("memtag_heap", globalSanitizersDiag); found &&
@@ -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.")