diff options
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index 84c1fce9b..e6a7a9356 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -318,6 +318,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 } |