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
This commit is contained in:
Luke Jones 2019-05-27 05:15:47 +00:00 committed by Git OBS Bridge
parent 7721178020
commit 9643ad5942
3 changed files with 36 additions and 1 deletions

26
fix-llvm8-build.patch Normal file
View File

@ -0,0 +1,26 @@
From b4131e297e18fde119f6f461b3e622218166b009 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sat May 25 12:23:30 UTC 2019 - Aaron Puchert <aaronpuchert@alice-dsl.net>
- 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

View File

@ -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