Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e97a7b4 authored by Jeff Vander Stoep's avatar Jeff Vander Stoep
Browse files

rust: Use host linker when building for Mac host.

This behavior is non-hermetic, but matches the behavior of the C++
support. On Linux, using lld works, but on OSX, this fails because lld
does not support Apple's new .tbd files.

Bug: 155302034
Test: On both Linux and Mac hosts:
    cd external/rust; mma

Change-Id: I0ad489113d720bdb9c3b7a67cce9d1e72266f428
parent ec7f59c7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -54,6 +54,9 @@ var (
		"-Wl,--pack-dyn-relocs=android+relr",
		"-Wl,--no-undefined",
		"-Wl,--hash-style=gnu",

		"-B${ccConfig.ClangBin}",
		"-fuse-ld=lld",
	}
)

@@ -80,7 +83,7 @@ func init() {

	pctx.ImportAs("ccConfig", "android/soong/cc/config")
	pctx.StaticVariable("RustLinker", "${ccConfig.ClangBin}/clang++")
	pctx.StaticVariable("RustLinkerArgs", "-B ${ccConfig.ClangBin} -fuse-ld=lld")
	pctx.StaticVariable("RustLinkerArgs", "")

	pctx.StaticVariable("DeviceGlobalLinkFlags", strings.Join(deviceGlobalLinkFlags, " "))

+4 −2
Original line number Diff line number Diff line
@@ -22,7 +22,9 @@ import (

var (
	DarwinRustFlags     = []string{}
	DarwinRustLinkFlags  = []string{}
	DarwinRustLinkFlags = []string{
		"-B${ccConfig.MacToolPath}",
	}
	darwinX8664Rustflags = []string{}
	darwinX8664Linkflags = []string{}
)
+5 −2
Original line number Diff line number Diff line
@@ -22,7 +22,10 @@ import (

var (
	LinuxRustFlags     = []string{}
	LinuxRustLinkFlags  = []string{}
	LinuxRustLinkFlags = []string{
		"-B${ccConfig.ClangBin}",
		"-fuse-ld=lld",
	}
	linuxX86Rustflags   = []string{}
	linuxX86Linkflags   = []string{}
	linuxX8664Rustflags = []string{}