summaryrefslogtreecommitdiff
path: root/rust/compiler.go
diff options
context:
space:
mode:
Diffstat (limited to 'rust/compiler.go')
-rw-r--r--rust/compiler.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/rust/compiler.go b/rust/compiler.go
index d6c52e8d4..98a61af55 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -327,10 +327,22 @@ 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.
+ if ctx.Os() == android.Linux {
+ // Add -lc, -lrt, -ldl, -lpthread, -lm and -lgcc_s to glibc builds to match
+ // the default behavior of device builds.
flags.LinkFlags = append(flags.LinkFlags,
+ "-lc",
+ "-lrt",
+ "-ldl",
+ "-lpthread",
+ "-lm",
+ "-lgcc_s",
+ )
+ } else if ctx.Os() == android.Darwin {
+ // Add -lc, -ldl, -lpthread and -lm to glibc darwin builds to match the default
+ // behavior of device builds.
+ flags.LinkFlags = append(flags.LinkFlags,
+ "-lc",
"-ldl",
"-lpthread",
"-lm",