From ca4487984017f35609486d7ce5626eaa9f3baf0d Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 1 Mar 2022 17:32:36 -0800 Subject: [PATCH] Fix s390x hangs, rhbz#2058803 --- rust-pr94505-mono-item-sort-local.patch | 34 +++++++++++++++++++++++++ rust.spec | 10 +++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 rust-pr94505-mono-item-sort-local.patch diff --git a/rust-pr94505-mono-item-sort-local.patch b/rust-pr94505-mono-item-sort-local.patch new file mode 100644 index 0000000..7710704 --- /dev/null +++ b/rust-pr94505-mono-item-sort-local.patch @@ -0,0 +1,34 @@ +diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs +index 892808386dee..13c325a14e40 100644 +--- a/compiler/rustc_middle/src/mir/mono.rs ++++ b/compiler/rustc_middle/src/mir/mono.rs +@@ -7,6 +7,7 @@ + use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; + use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; + use rustc_hir::ItemId; ++use rustc_index::vec::Idx; + use rustc_query_system::ich::{NodeIdHashingMode, StableHashingContext}; + use rustc_session::config::OptLevel; + use rustc_span::source_map::Span; +@@ -380,7 +381,7 @@ fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>) -> ItemSortKey<' + // instances into account. The others don't matter for + // the codegen tests and can even make item order + // unstable. +- InstanceDef::Item(def) => Some(def.did.index.as_usize()), ++ InstanceDef::Item(def) => def.did.as_local().map(Idx::index), + InstanceDef::VtableShim(..) + | InstanceDef::ReifyShim(..) + | InstanceDef::Intrinsic(..) +@@ -391,10 +392,8 @@ fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>) -> ItemSortKey<' + | InstanceDef::CloneShim(..) => None, + } + } +- MonoItem::Static(def_id) => Some(def_id.index.as_usize()), +- MonoItem::GlobalAsm(item_id) => { +- Some(item_id.def_id.to_def_id().index.as_usize()) +- } ++ MonoItem::Static(def_id) => def_id.as_local().map(Idx::index), ++ MonoItem::GlobalAsm(item_id) => Some(item_id.def_id.index()), + }, + item.symbol_name(tcx), + ) diff --git a/rust.spec b/rust.spec index 5759f17..831a54c 100644 --- a/rust.spec +++ b/rust.spec @@ -81,7 +81,7 @@ Name: rust Version: 1.59.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -100,6 +100,10 @@ Source1: %{wasi_libc_source} # By default, rust tries to use "rust-lld" as a linker for WebAssembly. Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch +# This regressed in 1.59, hanging builds on s390x, rhbz#2058803 +# https://github.com/rust-lang/rust/pull/94505 +Patch2: rust-pr94505-mono-item-sort-local.patch + ### RHEL-specific patches below ### # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) @@ -534,6 +538,7 @@ test -f '%{local_rust_root}/bin/rustc' %setup -q -n %{rustc_package} %patch1 -p1 +%patch2 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -972,6 +977,9 @@ end} %changelog +* Tue Mar 01 2022 Josh Stone - 1.59.0-2 +- Fix s390x hangs, rhbz#2058803 + * Thu Feb 24 2022 Josh Stone - 1.59.0-1 - Update to 1.59.0. - Revert to libgit2 1.3.x