Fix s390x hangs, rhbz#2058803

This commit is contained in:
Josh Stone 2022-03-01 17:32:36 -08:00
parent e605359b2b
commit ca44879840
2 changed files with 43 additions and 1 deletions

View File

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

View File

@ -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 <jistone@redhat.com> - 1.59.0-2
- Fix s390x hangs, rhbz#2058803
* Thu Feb 24 2022 Josh Stone <jistone@redhat.com> - 1.59.0-1
- Update to 1.59.0.
- Revert to libgit2 1.3.x