summaryrefslogtreecommitdiff
path: root/rust/compiler.go
diff options
context:
space:
mode:
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
}