rust: Add support for host fuzzers.

Adds support for host-based Rust fuzzers.

Bug: 282897366
Test: SANITZE_HOST="address" m <host_fuzzer>
Test: run fuzzer
Change-Id: Ibb951f651ef12e763778ebbf12e66769a7113920
This commit is contained in:
Ivan Lozano
2023-07-27 10:40:52 -04:00
parent 69bda98f50
commit 2fcbffa4a1
5 changed files with 48 additions and 8 deletions

View File

@@ -320,6 +320,15 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
flags.LinkFlags = append(flags.LinkFlags, cc.RpathFlags(ctx)...)
}
if !ctx.toolchain().Bionic() && ctx.Os() != android.LinuxMusl && !ctx.Windows() {
// Add -ldl, -lpthread, -lm and -lrt to host builds to match the default behavior of device
// builds. This is irrelevant for the Windows target as these are Posix specific.
flags.LinkFlags = append(flags.LinkFlags,
"-ldl",
"-lpthread",
"-lm",
)
}
return flags
}