diff options
author | 2023-10-03 19:12:50 -0700 | |
---|---|---|
committer | 2023-10-03 21:45:33 -0700 | |
commit | e18bd2097b955d40fb61019e168c7d04e0ba0e88 (patch) | |
tree | 7076f660f63f84b0b65918a79e7476a696cc6bfb /rust/compiler.go | |
parent | 4cbd49810c41722556ad5154ea920f3e4da72c01 (diff) |
Don't pass -lrt or -lgcc_s to darwin rust compiles
Fix mac builds by removing the -lrt and -lgcc_s flags from darwin
rust compiles.
Bug: 293349612
Test: builds
Change-Id: I99a9fea963761730efc4d3236135ee6d83dbca57
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index 6f61798be..98a61af55 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -327,9 +327,9 @@ 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 -lc, -lrt, -ldl, -lpthread, -lm, -lrt and -lgcc_s 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", @@ -338,6 +338,15 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag "-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", + ) } return flags } |