rust: Pass lld flags from cc to rust linker args.
Rust is not passing the sysroot flag to Clang when invoking it as the linker. This means files from the host may leak in, and host targets may fail if sysroot files are not available from the host. This patch prepends the lld flags from cc into rust linkargs. This pulls in the sysroots flag, and also ensures that we remain in sync with linkage flags used in cc. The '-Wl,--no-undefined-version' from cc is overridden to avoid missing version assignment errors for rust's generated alloc functions. Bug: 167690054 Test: cd external/rust; mma Test: strace -f -e %file <host libstd.dylib.so build command> pulls from correct sysroots. Change-Id: Ic40597f546f3b112012155614056afed487c6ca1
This commit is contained in:
@@ -42,22 +42,18 @@ var (
|
||||
deviceGlobalRustFlags = []string{}
|
||||
|
||||
deviceGlobalLinkFlags = []string{
|
||||
// Prepend the lld flags from cc_config so we stay in sync with cc
|
||||
"${cc_config.DeviceGlobalLldflags}",
|
||||
|
||||
// Override cc's --no-undefined-version to allow rustc's generated alloc functions
|
||||
"-Wl,--undefined-version",
|
||||
|
||||
"-Bdynamic",
|
||||
"-nostdlib",
|
||||
"-Wl,-z,noexecstack",
|
||||
"-Wl,-z,relro",
|
||||
"-Wl,-z,now",
|
||||
"-Wl,--build-id=md5",
|
||||
"-Wl,--warn-shared-textrel",
|
||||
"-Wl,--fatal-warnings",
|
||||
|
||||
"-Wl,--pack-dyn-relocs=android+relr",
|
||||
"-Wl,--use-android-relr-tags",
|
||||
"-Wl,--no-undefined",
|
||||
"-Wl,--hash-style=gnu",
|
||||
|
||||
"-B${cc_config.ClangBin}",
|
||||
"-fuse-ld=lld",
|
||||
}
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user