Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
rust: fix build with LLVM 9.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanaraps committed Sep 20, 2019
1 parent 86a56da commit 3e9982e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
5 changes: 5 additions & 0 deletions extra/rust/build
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh -e

patch -p1 < musl-libressl.patch
patch -p1 < rust-fix-llvm-9.patch

# 'rust' checksums files in 'vendor/', but we patch a few files.
for vendor in libc openssl-sys; do
Expand All @@ -10,6 +11,8 @@ done
cat > config.toml <<EOF
[llvm]
link-shared = true
thin-lto = false
optimize = true
[build]
build = "x86_64-unknown-linux-musl"
Expand Down Expand Up @@ -39,6 +42,8 @@ llvm-config = "/usr/bin/llvm-config"
crt-static = false
EOF

export RUSTFLAGS="-C link-args=-lffi"

python3 ./x.py build -j "$(nproc)"
DESTDIR="$1" python3 ./x.py install

Expand Down
1 change: 1 addition & 0 deletions extra/rust/checksums
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
120e7020d065499cc6b28759ff04153bfdc2ac9b5adeb252331a4eb87cbe38c3 rustc-1.37.0-src.tar.gz
0341881feff659cf705671d663157113fdc752d9bfb0cdfd5fc75daa65bdf1d5 musl-libressl.patch
a86b97ec4431b77488ab0b14306e9876f4f10a39ed626bee405713c1e4ef29c0 rust-fix-llvm-9.patch
1 change: 1 addition & 0 deletions extra/rust/depends
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake make
curl make
libffi
libressl
llvm
python make
Expand Down
26 changes: 26 additions & 0 deletions extra/rust/patches/rust-fix-llvm-9.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 04304fcd16e40c936dc5ba71c9ac3c445597f8bb Mon Sep 17 00:00:00 2001
From: Nikita Popov <nikita.ppv@gmail.com>
Date: Sat, 6 Jul 2019 19:02:48 +0200
Subject: [PATCH] Pass GUIDPreservedSymbols to
thinLTOResolvePrevailingInIndex()

---
src/rustllvm/PassWrapper.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index 0ebef82d3768..cea88f14dcc6 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -913,7 +913,10 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
GlobalValue::LinkageTypes NewLinkage) {
ResolvedODR[ModuleIdentifier][GUID] = NewLinkage;
};
-#if LLVM_VERSION_GE(8, 0)
+#if LLVM_VERSION_GE(9, 0)
+ thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage,
+ Ret->GUIDPreservedSymbols);
+#elif LLVM_VERSION_GE(8, 0)
thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage);
#else
thinLTOResolveWeakForLinkerInIndex(Ret->Index, isPrevailing, recordNewLinkage);
1 change: 1 addition & 0 deletions extra/rust/sources
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
https://static.rust-lang.org/dist/rustc-1.37.0-src.tar.gz
patches/musl-libressl.patch
patches/rust-fix-llvm-9.patch
2 changes: 1 addition & 1 deletion extra/rust/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.37.0 1
1.37.0 2

0 comments on commit 3e9982e

Please sign in to comment.