From ece45ed05f02f05194273e6653d98e3d3ed63459 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 8 Aug 2018 13:33:52 -0700 Subject: [PATCH 1/3] Revert part of pr50949 for LLVM5 --- ...vm-remove-closure-env-alloca-hack-ar.patch | 62 +++++++++++++++++++ rust.spec | 7 +++ 2 files changed, 69 insertions(+) create mode 100644 0001-rustc_codegen_llvm-remove-closure-env-alloca-hack-ar.patch diff --git a/0001-rustc_codegen_llvm-remove-closure-env-alloca-hack-ar.patch b/0001-rustc_codegen_llvm-remove-closure-env-alloca-hack-ar.patch new file mode 100644 index 0000000..82b8dbb --- /dev/null +++ b/0001-rustc_codegen_llvm-remove-closure-env-alloca-hack-ar.patch @@ -0,0 +1,62 @@ +From da579ef75e4a8ca11fb98b24a0a3ea0c7ccffeeb Mon Sep 17 00:00:00 2001 +From: Eduard-Mihai Burtescu +Date: Mon, 21 May 2018 20:38:41 +0300 +Subject: [PATCH] rustc_codegen_llvm: remove closure env alloca hack around + upvar debuginfo. + +--- + src/librustc_codegen_llvm/mir/mod.rs | 24 ++---------------------- + 1 file changed, 2 insertions(+), 22 deletions(-) + +diff --git a/src/librustc_codegen_llvm/mir/mod.rs b/src/librustc_codegen_llvm/mir/mod.rs +index a91a6e251aa7..d34f881bf9dd 100644 +--- a/src/librustc_codegen_llvm/mir/mod.rs ++++ b/src/librustc_codegen_llvm/mir/mod.rs +@@ -583,23 +583,6 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>, + }; + let upvar_tys = upvar_substs.upvar_tys(def_id, tcx); + +- // Store the pointer to closure data in an alloca for debuginfo +- // because that's what the llvm.dbg.declare intrinsic expects. +- +- // FIXME(eddyb) this shouldn't be necessary but SROA seems to +- // mishandle DW_OP_plus not preceded by DW_OP_deref, i.e. it +- // doesn't actually strip the offset when splitting the closure +- // environment into its components so it ends up out of bounds. +- let env_ptr = if !env_ref { +- let scratch = PlaceRef::alloca(bx, +- bx.cx.layout_of(tcx.mk_mut_ptr(arg.layout.ty)), +- "__debuginfo_env_ptr"); +- bx.store(place.llval, scratch.llval, scratch.align); +- scratch.llval +- } else { +- place.llval +- }; +- + for (i, (decl, ty)) in mir.upvar_decls.iter().zip(upvar_tys).enumerate() { + let byte_offset_of_var_in_env = closure_layout.fields.offset(i).bytes(); + +@@ -611,10 +594,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>, + }; + + // The environment and the capture can each be indirect. +- +- // FIXME(eddyb) see above why we have to keep +- // a pointer in an alloca for debuginfo atm. +- let mut ops = if env_ref || true { &ops[..] } else { &ops[1..] }; ++ let mut ops = if env_ref { &ops[..] } else { &ops[1..] }; + + let ty = if let (true, &ty::TyRef(_, ty, _)) = (decl.by_ref, &ty.sty) { + ty +@@ -624,7 +604,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>, + }; + + let variable_access = VariableAccess::IndirectVariable { +- alloca: env_ptr, ++ alloca: place.llval, + address_operations: &ops + }; + declare_local( +-- +2.17.1 + diff --git a/rust.spec b/rust.spec index 526bedb..82a4658 100644 --- a/rust.spec +++ b/rust.spec @@ -76,6 +76,11 @@ Patch1: rust-52760-test_loading_atoi.patch # https://github.com/rust-lang/rust/pull/52876 Patch2: rust-52876-const-endianess.patch +# https://github.com/rust-lang/rust/issues/53204 +# From https://github.com/rust-lang/rust/pull/50949 +# This second commit causes problems with LLVM 5 debuginfo -- reverting. +Patch3: 0001-rustc_codegen_llvm-remove-closure-env-alloca-hack-ar.patch + # Get the Rust triple for any arch. %{lua: function rust_triple(arch) local abi = "gnu" @@ -377,6 +382,8 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 +%patch3 -p1 -R + %if "%{python}" == "python3" sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure %endif From 8dd1169f89e0b1d721cd53bcc6138ef7e4e67ce6 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 31 Oct 2018 15:47:45 -0700 Subject: [PATCH 2/3] Re-bootstrap ppc64le for rust#54545 --- rust.spec | 2 ++ sources | 1 + 2 files changed, 3 insertions(+) diff --git a/rust.spec b/rust.spec index ecce5a0..389fed0 100644 --- a/rust.spec +++ b/rust.spec @@ -16,6 +16,7 @@ # Only the specified arches will use bootstrap binaries. #global bootstrap_arches %%{rust_arches} +%global bootstrap_arches ppc64le # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. %bcond_with llvm_static @@ -684,6 +685,7 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %changelog * Thu Oct 25 2018 Josh Stone - 1.30.0-6 - Update to 1.30.0. +- Re-bootstrap ppc64le for rust#54545 * Fri Oct 12 2018 Josh Stone - 1.29.2-3 - Update to 1.29.2. diff --git a/sources b/sources index 53d5f2e..ec99e8b 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (rustc-1.30.0-src.tar.xz) = f5f2f8379b43f68a9c1acd476a41fab2fb3a9458146fbdb21dfb2f5d1ab86905933b9541e866f5fbb520dafe349e0ab87bc6c9466774c4616007d547e6aeaa59 +SHA512 (rust-1.29.2-powerpc64le-unknown-linux-gnu.tar.xz) = b9181da601a467f46713f2f438fc7ad69c46fc310e62a8d45f665744c8578491d832b8624ff454c19c94f1694fa406846a82289250241030a70b2cb4b88913d1 From 0c0aa24aa3b4c04e59e7c932d820a91aa0ee6d9d Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 1 Nov 2018 09:09:30 -0700 Subject: [PATCH 3/3] Rebuild without bootstrap binaries. --- rust.spec | 6 ++++-- sources | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rust.spec b/rust.spec index 389fed0..b446105 100644 --- a/rust.spec +++ b/rust.spec @@ -16,7 +16,6 @@ # Only the specified arches will use bootstrap binaries. #global bootstrap_arches %%{rust_arches} -%global bootstrap_arches ppc64le # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. %bcond_with llvm_static @@ -64,7 +63,7 @@ Name: rust Version: %{rustc_version} -Release: 6%{?dist} +Release: 6%{?dist}.1 Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -683,6 +682,9 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %changelog +* Thu Nov 01 2018 Josh Stone - 1.30.0-6.1 +- Rebuild without bootstrap binaries. + * Thu Oct 25 2018 Josh Stone - 1.30.0-6 - Update to 1.30.0. - Re-bootstrap ppc64le for rust#54545 diff --git a/sources b/sources index ec99e8b..53d5f2e 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ SHA512 (rustc-1.30.0-src.tar.xz) = f5f2f8379b43f68a9c1acd476a41fab2fb3a9458146fbdb21dfb2f5d1ab86905933b9541e866f5fbb520dafe349e0ab87bc6c9466774c4616007d547e6aeaa59 -SHA512 (rust-1.29.2-powerpc64le-unknown-linux-gnu.tar.xz) = b9181da601a467f46713f2f438fc7ad69c46fc310e62a8d45f665744c8578491d832b8624ff454c19c94f1694fa406846a82289250241030a70b2cb4b88913d1