summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Yakovlev <gyakovlev@gentoo.org>2019-01-25 17:13:29 -0800
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2019-01-25 18:58:35 -0800
commit34783cfa9869949d36d723bcdf0039f3308abee8 (patch)
tree06d1520116faeef68b58ade462300a3c70bde334 /dev-lang/rust
parentmedia-libs/allegro: Stable -r2 for bug 670781 (diff)
downloadgentoo-34783cfa9869949d36d723bcdf0039f3308abee8.tar.gz
gentoo-34783cfa9869949d36d723bcdf0039f3308abee8.tar.bz2
gentoo-34783cfa9869949d36d723bcdf0039f3308abee8.zip
dev-lang/rust: fix segfaults with system llvm:7
Bug: https://bugs.gentoo.org/675752 Package-Manager: Portage-2.3.57, Repoman-2.3.12 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'dev-lang/rust')
-rw-r--r--dev-lang/rust/files/1.32.0-system-llvm-7-SIGSEGV.patch33
-rw-r--r--dev-lang/rust/rust-1.32.0.ebuild1
2 files changed, 34 insertions, 0 deletions
diff --git a/dev-lang/rust/files/1.32.0-system-llvm-7-SIGSEGV.patch b/dev-lang/rust/files/1.32.0-system-llvm-7-SIGSEGV.patch
new file mode 100644
index 000000000000..afc2cabde4b5
--- /dev/null
+++ b/dev-lang/rust/files/1.32.0-system-llvm-7-SIGSEGV.patch
@@ -0,0 +1,33 @@
+From 1c95f5a34c14f08d65cdd198827e3a2fcb63cf39 Mon Sep 17 00:00:00 2001
+From: Tom Tromey <tom@tromey.com>
+Date: Tue, 22 Jan 2019 11:13:53 -0700
+Subject: [PATCH] Fix issue 57762
+
+Issue 57762 points out a compiler crash when the compiler was built
+using a stock LLVM 7. LLVM 7 was released without a necessary fix for
+a bug in the DWARF discriminant code.
+
+This patch changes rustc to use the fallback mode on (non-Rust) LLVM 7.
+
+Closes #57762
+---
+ src/librustc_codegen_llvm/debuginfo/metadata.rs | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs
+index 6deedd0b5ea3..a354eef6887a 100644
+--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs
++++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs
+@@ -1164,7 +1164,11 @@ fn use_enum_fallback(cx: &CodegenCx) -> bool {
+ // On MSVC we have to use the fallback mode, because LLVM doesn't
+ // lower variant parts to PDB.
+ return cx.sess().target.target.options.is_like_msvc
+- || llvm_util::get_major_version() < 7;
++ || llvm_util::get_major_version() < 7
++ // LLVM version 7 did not release with an important bug fix;
++ // but the required patch is in the equivalent Rust LLVM.
++ // See https://github.com/rust-lang/rust/issues/57762.
++ || (llvm_util::get_major_version() == 7 && unsafe { !llvm::LLVMRustIsRustLLVM() });
+ }
+
+ // Describes the members of an enum value: An enum is described as a union of
diff --git a/dev-lang/rust/rust-1.32.0.ebuild b/dev-lang/rust/rust-1.32.0.ebuild
index d7262e896e2a..bc2a6106b8ad 100644
--- a/dev-lang/rust/rust-1.32.0.ebuild
+++ b/dev-lang/rust/rust-1.32.0.ebuild
@@ -64,6 +64,7 @@ S="${WORKDIR}/${MY_P}-src"
PATCHES=(
"${FILESDIR}"/1.30.1-clippy-sysroot.patch
"${FILESDIR}"/1.32.0-fix-configure-of-bundled-llvm.patch
+ "${FILESDIR}"/1.32.0-system-llvm-7-SIGSEGV.patch
)
toml_usex() {