From 9643ad59423cfa3f80f871bbb73c058d35b624e30ebe176c63ce86795c877e69 Mon Sep 17 00:00:00 2001 From: Luke Jones Date: Mon, 27 May 2019 05:15:47 +0000 Subject: [PATCH] Accepting request 705460 from home:aaronpuchert Fix build with LLVM 8. OBS-URL: https://build.opensuse.org/request/show/705460 OBS-URL: https://build.opensuse.org/package/show/devel:languages:rust/rust?expand=0&rev=218 --- fix-llvm8-build.patch | 26 ++++++++++++++++++++++++++ rust.changes | 6 ++++++ rust.spec | 5 ++++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 fix-llvm8-build.patch diff --git a/fix-llvm8-build.patch b/fix-llvm8-build.patch new file mode 100644 index 0000000..7aeebb0 --- /dev/null +++ b/fix-llvm8-build.patch @@ -0,0 +1,26 @@ +From b4131e297e18fde119f6f461b3e622218166b009 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 26 Apr 2019 08:58:14 -0700 +Subject: [PATCH] Limit internalization in LLVM 8 ThinLTO + +--- + 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 319c66a21f17..0ebef82d3768 100644 +--- a/src/rustllvm/PassWrapper.cpp ++++ b/src/rustllvm/PassWrapper.cpp +@@ -873,8 +873,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, + return PrevailingType::Unknown; + }; + #if LLVM_VERSION_GE(8, 0) ++ // We don't have a complete picture in our use of ThinLTO, just our immediate ++ // crate, so we need `ImportEnabled = false` to limit internalization. ++ // Otherwise, we sometimes lose `static` values -- see #60184. + computeDeadSymbolsWithConstProp(Ret->Index, Ret->GUIDPreservedSymbols, +- deadIsPrevailing, /* ImportEnabled = */ true); ++ deadIsPrevailing, /* ImportEnabled = */ false); + #else + computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing); + #endif diff --git a/rust.changes b/rust.changes index 43cb58e..8839c07 100644 --- a/rust.changes +++ b/rust.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat May 25 12:23:30 UTC 2019 - Aaron Puchert + +- Add fix-llvm8-build.patch: Fix linker errors with llvm8 by + limiting internalization in ThinLTO. + ------------------------------------------------------------------- Fri May 17 23:06:25 UTC 2019 - federico@suse.com diff --git a/rust.spec b/rust.spec index 8a0387e..19f1f9b 100644 --- a/rust.spec +++ b/rust.spec @@ -13,7 +13,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -96,6 +96,8 @@ Source106: %{dl_url}/rust-%{version_bootstrap}-powerpc64le-unknown-linux-gn Source107: %{dl_url}/rust-%{version_bootstrap}-s390x-unknown-linux-gnu.tar.xz # PATCH-FIX-OPENSUSE: edit src/librustc_llvm/build.rs to ignore GCC incompatible flag Patch0: ignore-Wstring-conversion.patch +# PATCH-FIX-UPSTREAM: gh#rust-lang/rust#60184 +Patch1: fix-llvm8-build.patch BuildRequires: ccache # Leap 42 to 42.3, SLE12 SP1, SP2 %if 0%{?sle_version} >= 120000 && 0%{?sle_version} <= 120200 @@ -336,6 +338,7 @@ This package includes HTML documentation for Cargo. %setup -q -n rustc-%{version}-src %patch0 -p1 +%patch1 -p1 # use python3 sed -i -e "1s|#!.*|#!%{_bindir}/python3|" x.py