summaryrefslogtreecommitdiff
path: root/rust/compiler.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2023-07-27 10:40:52 -0400
committer Ivan Lozano <ivanlozano@google.com> 2023-08-10 09:48:13 -0400
commit2fcbffa4a1dd445586bb6be14caa38ba3ef4bdc3 (patch)
tree17e9dc29401c8d303404252f7564fff72512cd5c /rust/compiler.go
parent69bda98f506e2c585d43e74d374ea09892db4218 (diff)
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
Diffstat (limited to 'rust/compiler.go')
-rw-r--r--rust/compiler.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/rust/compiler.go b/rust/compiler.go
index 06ae12f79..8d89c4805 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -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
}