Backport a couple of fixes from upstream

One fix to a problem that broke mesa build, and one fix to a
problem that broke rust bootstrap.
This commit is contained in:
Adam Williamson 2023-01-27 15:00:45 -08:00
parent d90cdf5795
commit 23df2b257f
3 changed files with 81 additions and 1 deletions

26
107360-modified.patch Normal file
View File

@ -0,0 +1,26 @@
From de363d54c40a378717881240e719f5f7223ba376 Mon Sep 17 00:00:00 2001
From: bjorn3 <17426603+bjorn3@users.noreply.github.com>
Date: Fri, 27 Jan 2023 11:48:36 +0000
Subject: [PATCH 3/4] Revert back to LlvmArchiveBuilder on all platforms
ArArchiveBuilder doesn't support reading thin archives, causing a
regression.
---
compiler/rustc_codegen_llvm/src/back/archive.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs
index b00676b7c592b..58ca87524deb6 100644
--- a/compiler/rustc_codegen_llvm/src/back/archive.rs
+++ b/compiler/rustc_codegen_llvm/src/back/archive.rs
@@ -108,7 +108,9 @@ pub struct LlvmArchiveBuilderBuilder;
impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box<dyn ArchiveBuilder<'a> + 'a> {
- if sess.target.arch == "wasm32" || sess.target.arch == "wasm64" {
+ // FIXME use ArArchiveBuilder on most targets again once reading thin archives is
+ // implemented
+ if true || sess.target.arch == "wasm32" || sess.target.arch == "wasm64" {
Box::new(LlvmArchiveBuilder { sess, additions: Vec::new() })
} else {
Box::new(ArArchiveBuilder::new(sess, get_llvm_object_symbols))

View File

@ -0,0 +1,38 @@
From 675fa0b3dd5fe14b43ad5b7862f4528df7322468 Mon Sep 17 00:00:00 2001
From: Michael Goulet <michael@errs.io>
Date: Mon, 12 Dec 2022 18:29:33 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20fix=20unsoundness=20in=20bootstr?=
=?UTF-8?q?ap=20cache=20code?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/bootstrap/cache.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs
index be5c9bb078808..05f25af68ea8f 100644
--- a/src/bootstrap/cache.rs
+++ b/src/bootstrap/cache.rs
@@ -89,16 +89,16 @@ impl<T: Internable + Hash> Hash for Interned<T> {
impl<T: Internable + Deref> Deref for Interned<T> {
type Target = T::Target;
- fn deref(&self) -> &'static Self::Target {
+ fn deref(&self) -> &Self::Target {
let l = T::intern_cache().lock().unwrap();
- unsafe { mem::transmute::<&Self::Target, &'static Self::Target>(l.get(*self)) }
+ unsafe { mem::transmute::<&Self::Target, &Self::Target>(l.get(*self)) }
}
}
impl<T: Internable + AsRef<U>, U: ?Sized> AsRef<U> for Interned<T> {
- fn as_ref(&self) -> &'static U {
+ fn as_ref(&self) -> &U {
let l = T::intern_cache().lock().unwrap();
- unsafe { mem::transmute::<&U, &'static U>(l.get(*self).as_ref()) }
+ unsafe { mem::transmute::<&U, &U>(l.get(*self).as_ref()) }
}
}

View File

@ -84,7 +84,7 @@
Name: rust Name: rust
Version: 1.67.0 Version: 1.67.0
Release: 1%{?dist} Release: 2awb%{?dist}
Summary: The Rust Programming Language Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and MIT) License: (ASL 2.0 or MIT) and (BSD and MIT)
# ^ written as: (rust itself) and (bundled libraries) # ^ written as: (rust itself) and (bundled libraries)
@ -106,6 +106,16 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch
# Set a substitute-path in rust-gdb for standard library sources. # Set a substitute-path in rust-gdb for standard library sources.
Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch
# Fix bootstrap failure
# https://github.com/rust-lang/rust/commit/675fa0b3dd5fe14b43ad5b7862f4528df7322468
Patch3: 675fa0b3dd5fe14b43ad5b7862f4528df7322468.patch
# fix build of mesa, possibly other things; patch edited to only
# include the one commit necessary on top of 1.67.0
# https://github.com/rust-lang/rust/issues/107334
# https://github.com/rust-lang/rust/pull/107360
Patch4: 107360-modified.patch
### RHEL-specific patches below ### ### RHEL-specific patches below ###
# Simple rpm macros for rust-toolset (as opposed to full rust-packaging) # Simple rpm macros for rust-toolset (as opposed to full rust-packaging)
@ -580,6 +590,8 @@ test -f '%{local_rust_root}/bin/rustc'
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1
%patch4 -p1
%if %with disabled_libssh2 %if %with disabled_libssh2
%patch100 -p1 %patch100 -p1
@ -1035,6 +1047,10 @@ end}
%changelog %changelog
* Fri Jan 27 2023 Adam Williamson <awilliam@redhat.com> - 1.67.0-2
- Backport PR #107360 to fix build of mesa
- Backport 675fa0b3 to fix bootstrapping failure
* Thu Jan 26 2023 Josh Stone <jistone@redhat.com> - 1.67.0-1 * Thu Jan 26 2023 Josh Stone <jistone@redhat.com> - 1.67.0-1
- Update to 1.67.0. - Update to 1.67.0.