Update to Rust 1.87.0

Resolves: RHEL-81600
Resolves: RHEL-81608
This commit is contained in:
Josh Stone 2025-05-29 14:20:59 -07:00
parent d2f483656b
commit c48009d982
7 changed files with 111 additions and 67 deletions

1
.gitignore vendored
View File

@ -452,3 +452,4 @@
/rustc-1.85.1-src.tar.xz
/rustc-1.86.0-src.tar.xz
/wasi-libc-640c0cfc19a96b099e0791824be5ef0105ce2084.tar.gz
/rustc-1.87.0-src.tar.xz

View File

@ -0,0 +1,42 @@
From dc0fbcab7e0673afe62b3e8e74905d9e5f5b74a4 Mon Sep 17 00:00:00 2001
From: Jesus Checa Hidalgo <jchecahi@redhat.com>
Date: Fri, 11 Apr 2025 16:57:38 +0200
Subject: [PATCH] Fix profiler_builtins build script to handle full path to
profiler lib
LLVM_PROFILER_RT_LIB may be set to an absolute path (e.g., in Fedora builds),
but `-l` expects a library name, not a path. After #138273, this caused builds
to fail with a "could not find native static library" error.
This patch updates the build script to split the path into directory and
filename, using `cargo::rustc-link-search` for the directory and
`cargo::rustc-link-lib=+verbatim` for the file. This allows profiler_builtins to
correctly link the static library even when an absolute path is provided.
---
library/profiler_builtins/build.rs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/library/profiler_builtins/build.rs b/library/profiler_builtins/build.rs
index dd85239fa8c..fc1a9ecc1ec 100644
--- a/library/profiler_builtins/build.rs
+++ b/library/profiler_builtins/build.rs
@@ -9,8 +9,14 @@
fn main() {
if let Ok(rt) = tracked_env_var("LLVM_PROFILER_RT_LIB") {
- println!("cargo::rustc-link-lib=static:+verbatim={rt}");
- return;
+ let rt = PathBuf::from(rt);
+ if let Some(lib) = rt.file_name() {
+ if let Some(dir) = rt.parent() {
+ println!("cargo::rustc-link-search=native={}", dir.display());
+ }
+ println!("cargo::rustc-link-lib=static:+verbatim={}", lib.to_str().unwrap());
+ return;
+ }
}
let target_os = env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS was not set");
--
2.49.0

View File

@ -1,22 +1,22 @@
From c3307f4e1826cabd8e7e4a54636b0e79afb97835 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:14:28 -0700
From e8833a9032b9f5773ef891b3f12b93322d6b4950 Mon Sep 17 00:00:00 2001
From: Jesus Checa Hidalgo <jchecahi@redhat.com>
Date: Mon, 7 Apr 2025 16:59:10 +0200
Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
---
config.example.toml | 5 +++++
bootstrap.example.toml | 5 +++++
src/bootstrap/src/core/build_steps/compile.rs | 4 ++++
src/bootstrap/src/core/config/config.rs | 8 ++++++++
src/bootstrap/src/lib.rs | 5 +++++
4 files changed, 22 insertions(+)
diff --git a/config.example.toml b/config.example.toml
index f5395375afe4..a96368ae4ef2 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -927,6 +927,11 @@
# order to run `x check`.
#optimized-compiler-builtins = build.optimized-compiler-builtins (bool)
diff --git a/bootstrap.example.toml b/bootstrap.example.toml
index 2a98821f225..580d6b2a8a2 100644
--- a/bootstrap.example.toml
+++ b/bootstrap.example.toml
@@ -948,6 +948,11 @@
# This overrides the global `rust.jemalloc` option. See that option for more info.
#jemalloc = rust.jemalloc (bool)
+# Copy libc and CRT objects into the target lib/self-contained/ directory.
+# Enabled by default on `musl`, `wasi`, and `windows-gnu` targets. Other
@ -27,10 +27,10 @@ index f5395375afe4..a96368ae4ef2 100644
# Distribution options
#
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 479327d63695..97d2bf2df8bb 100644
index 18b5d4426b1..3de9667123b 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -327,6 +327,10 @@ fn copy_self_contained_objects(
@@ -370,6 +370,10 @@ fn copy_self_contained_objects(
compiler: &Compiler,
target: TargetSelection,
) -> Vec<(PathBuf, DependencyType)> {
@ -42,18 +42,18 @@ index 479327d63695..97d2bf2df8bb 100644
builder.sysroot_target_libdir(*compiler, target).join("self-contained");
t!(fs::create_dir_all(&libdir_self_contained));
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 65f286a05bd5..dc4d6f741bcf 100644
index bbb0fbfbb93..8642a86cbf8 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -643,6 +643,7 @@ pub struct Target {
pub no_std: bool,
@@ -666,6 +666,7 @@ pub struct Target {
pub codegen_backends: Option<Vec<String>>,
pub optimized_compiler_builtins: Option<bool>,
pub jemalloc: Option<bool>,
+ pub self_contained: bool,
}
impl Target {
@@ -654,6 +655,9 @@ pub fn from_triple(triple: &str) -> Self {
@@ -677,6 +678,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("emscripten") {
target.runner = Some("node".into());
}
@ -63,15 +63,15 @@ index 65f286a05bd5..dc4d6f741bcf 100644
target
}
}
@@ -1234,6 +1238,7 @@ struct TomlTarget {
codegen_backends: Option<Vec<String>> = "codegen-backends",
@@ -1292,6 +1296,7 @@ struct TomlTarget {
runner: Option<String> = "runner",
optimized_compiler_builtins: Option<bool> = "optimized-compiler-builtins",
jemalloc: Option<bool> = "jemalloc",
+ self_contained: Option<bool> = "self-contained",
}
}
@@ -2146,6 +2151,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
@@ -2245,6 +2250,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
if let Some(s) = cfg.no_std {
target.no_std = s;
}
@ -82,10 +82,10 @@ index 65f286a05bd5..dc4d6f741bcf 100644
target.cxx = cfg.cxx.map(PathBuf::from);
target.ar = cfg.ar.map(PathBuf::from);
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 21b02a3b541a..6b98c67457e8 100644
index 843d474f92d..3a4398ee1f8 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1366,6 +1366,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
@@ -1434,6 +1434,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
self.config.target_config.get(&target).map(|t| t.no_std)
}

View File

@ -1,6 +1,6 @@
From 9551ffded09131ac225261ab55a7b3c9d09ad3bb Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:18:16 -0700
From 35a37bd892939b8a1cd194632de3b9dd3a3d479b Mon Sep 17 00:00:00 2001
From: Jesus Checa Hidalgo <jchecahi@redhat.com>
Date: Mon, 7 Apr 2025 17:22:56 +0200
Subject: [PATCH 2/2] set an external library path for wasm32-wasi
---
@ -11,10 +11,10 @@ Subject: [PATCH 2/2] set an external library path for wasm32-wasi
4 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index 105a4cb81f0d..21bd626842c7 100644
index b59d73a9aae..2369d73b4e3 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1686,6 +1686,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
@@ -1583,6 +1583,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
return file_path;
}
}
@ -27,10 +27,10 @@ index 105a4cb81f0d..21bd626842c7 100644
for search_path in sess.target_filesearch().search_paths(PathKind::Native) {
let file_path = search_path.dir.join(name);
if file_path.exists() {
@@ -2186,6 +2192,10 @@ fn add_library_search_dirs(
@@ -2140,6 +2146,10 @@ fn add_library_search_dirs(
}
ControlFlow::<()>::Continue(())
},
);
});
+
+ if let Some(lib_path) = &sess.target.options.external_lib_path {
+ cmd.include_path(Path::new(lib_path.as_ref()));
@ -39,10 +39,10 @@ index 105a4cb81f0d..21bd626842c7 100644
/// Add options making relocation sections in the produced ELF files read-only
diff --git a/compiler/rustc_target/src/spec/json.rs b/compiler/rustc_target/src/spec/json.rs
index f703132e51f0..c4821be7d12e 100644
index 4b6de5e18f5..373301d85ab 100644
--- a/compiler/rustc_target/src/spec/json.rs
+++ b/compiler/rustc_target/src/spec/json.rs
@@ -540,6 +540,7 @@ macro_rules! key {
@@ -559,6 +559,7 @@ macro_rules! key {
key!(linker_is_gnu_json = "linker-is-gnu", bool);
key!(pre_link_objects = "pre-link-objects", link_objects);
key!(post_link_objects = "post-link-objects", link_objects);
@ -50,7 +50,7 @@ index f703132e51f0..c4821be7d12e 100644
key!(pre_link_objects_self_contained = "pre-link-objects-fallback", link_objects);
key!(post_link_objects_self_contained = "post-link-objects-fallback", link_objects);
// Deserializes the backwards-compatible variants of `-Clink-self-contained`
@@ -723,6 +724,7 @@ macro_rules! target_option_val {
@@ -744,6 +745,7 @@ macro_rules! target_option_val {
target_option_val!(linker_is_gnu_json, "linker-is-gnu");
target_option_val!(pre_link_objects);
target_option_val!(post_link_objects);
@ -59,10 +59,10 @@ index f703132e51f0..c4821be7d12e 100644
target_option_val!(post_link_objects_self_contained, "post-link-objects-fallback");
target_option_val!(link_args - pre_link_args_json, "pre-link-args");
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 794d6457cb78..b2d88a14bb57 100644
index 7234d1dc63e..3ec85bbf279 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -2237,6 +2237,7 @@ pub struct TargetOptions {
@@ -2301,6 +2301,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects,
@ -70,7 +70,7 @@ index 794d6457cb78..b2d88a14bb57 100644
/// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled.
pub pre_link_objects_self_contained: CrtObjects,
pub post_link_objects_self_contained: CrtObjects,
@@ -2754,6 +2755,7 @@ fn default() -> TargetOptions {
@@ -2821,6 +2822,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None,
pre_link_objects: Default::default(),
post_link_objects: Default::default(),
@ -79,10 +79,10 @@ index 794d6457cb78..b2d88a14bb57 100644
post_link_objects_self_contained: Default::default(),
link_self_contained: LinkSelfContainedDefault::False,
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
index 0862958d05da..b1e736d68627 100644
index 26add451ed2..3eaf050e682 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
@@ -19,11 +19,12 @@ pub(crate) fn target() -> Target {
@@ -21,11 +21,12 @@ pub(crate) fn target() -> Target {
options.env = "p1".into();
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasip1"]);

View File

@ -1,5 +1,5 @@
Name: rust
Version: 1.86.0
Version: 1.87.0
Release: %autorelease
Summary: The Rust Programming Language
License: (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
@ -14,9 +14,9 @@ ExclusiveArch: %{rust_arches}
# To bootstrap from scratch, set the channel and date from src/stage0.json
# e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13
# or nightly wants some beta-YYYY-MM-DD
%global bootstrap_version 1.85.0
%global bootstrap_channel 1.85.0
%global bootstrap_date 2025-02-20
%global bootstrap_version 1.86.0
%global bootstrap_channel 1.86.0
%global bootstrap_date 2025-04-03
# Only the specified arches will use bootstrap binaries.
# NOTE: Those binaries used to be uploaded with every new release, but that was
@ -45,7 +45,7 @@ ExclusiveArch: %{rust_arches}
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 18.0+.
%global min_llvm_version 18.0.0
%global bundled_llvm_version 19.1.7
%global bundled_llvm_version 20.1.1
#global llvm_compat_version 19
%global llvm llvm%{?llvm_compat_version}
%bcond_with bundled_llvm
@ -138,7 +138,11 @@ Patch4: 0001-bootstrap-allow-disabling-target-self-contained.patch
Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch
# We don't want to use the bundled library in libsqlite3-sys
Patch6: rustc-1.86.0-unbundle-sqlite.patch
Patch6: rustc-1.87.0-unbundle-sqlite.patch
# Split the absolute path of libclang_rt.profile.a when passed to profiler_builtns
# Upstream PR: https://github.com/rust-lang/rust/pull/139677
Patch7: 0001-Fix-profiler_builtins-build-script-to-handle-full-pa.patch
### RHEL-specific patches below ###
@ -683,6 +687,8 @@ rm -rf %{wasi_libc_dir}/dlmalloc/
%patch -P6 -p1
%endif
%patch -P7 -p1
%if %with disabled_libssh2
%patch -P100 -p1
%endif
@ -871,7 +877,7 @@ test -r "%{profiler}"
--set build.optimized-compiler-builtins=false \
--set rust.llvm-tools=false \
--enable-extended \
--tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \
--tools=cargo,clippy,rust-analyzer,rustfmt,src \
--enable-vendor \
--enable-verbose-tests \
--release-channel=%{channel} \
@ -879,29 +885,29 @@ test -r "%{profiler}"
%global __x %{__python3} ./x.py
# Skipping PGO on s390x until we get LLVM 20, due to
# https://github.com/llvm/llvm-project/issues/124001
%ifnarch s390x
# rustc is exibiting signs of miscompilation on pwr9+pgo (root cause TBD),
# so we're skipping pgo on rhel ppc64le for now.
%if !( 0%{?rhel} && "%{_target_cpu}" == "ppc64le" )
%if %with rustc_pgo
# - rustc is exibiting signs of miscompilation on pwr9+pgo (root cause TBD),
# so we're skipping pgo on rhel ppc64le for now. See RHEL-88598 for more.
# - Since 1.87, Fedora started getting ppc64le segfaults, and this also seems
# to be avoidable by skipping pgo. See bz2367960 for examples of that.
%if %{with rustc_pgo} && !( "%{_target_cpu}" == "ppc64le" )
# Build the compiler with profile instrumentation
%define profraw $PWD/build/profiles
%define profdata $PWD/build/rustc.profdata
mkdir -p "%{profraw}"
%{__x} build sysroot --rust-profile-generate="%{profraw}"
# Build cargo as a workload to generate compiler profiles
# We normally use `x.py`, but in this case we invoke the stage 2 compiler and libs
# directly to ensure we use the instrumented compiler.
env LLVM_PROFILE_FILE="%{profraw}/default_%%m_%%p.profraw" \
%{__x} --keep-stage=0 --keep-stage=1 build cargo
LD_LIBRARY_PATH=$PWD/build/host/stage2/lib \
RUSTC=$PWD/build/host/stage2/bin/rustc \
cargo build --manifest-path=src/tools/cargo/Cargo.toml
# Finalize the profile data and clean up the raw files
llvm-profdata merge -o "%{profdata}" "%{profraw}"
rm -r "%{profraw}" build/%{rust_triple}/stage2*/
# Redefine the macro to use that profile data from now on
%global __x %{__x} --rust-profile-use="%{profdata}"
%endif
%endif
%endif
# Build the compiler normally (with or without PGO)
%{__x} build sysroot
@ -941,9 +947,6 @@ for triple in %{?all_targets} ; do
DESTDIR=%{buildroot} %{__x} install --target=$triple std
done
# The rls stub doesn't have an install target, but we can just copy it.
%{__install} -t %{buildroot}%{_bindir} build/%{rust_triple}/stage2-tools-bin/rls
# These are transient files used by x.py dist and install
rm -rf ./build/dist/ ./build/tmp/
@ -1061,7 +1064,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{__x} test --no-fail-fast rustfmt || :
%ldconfig_scriptlets
@ -1188,7 +1190,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%files analyzer
%{_bindir}/rls
%{_bindir}/rust-analyzer
%doc src/tools/rust-analyzer/README.md
%license src/tools/rust-analyzer/LICENSE-{APACHE,MIT}

View File

@ -10,14 +10,14 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools
"vcpkg",
]
diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2025-03-11 15:30:39.384466481 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2025-03-11 15:32:05.989298381 -0700
@@ -80,7 +80,7 @@ proptest = "1.6.0"
pulldown-cmark = { version = "0.12.2", default-features = false, features = ["html"] }
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2025-04-07 20:37:44.467359012 +0200
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2025-04-07 20:38:17.564060339 +0200
@@ -79,7 +79,7 @@ proptest = "1.6.0"
pulldown-cmark = { version = "0.13.0", default-features = false, features = ["html"] }
rand = "0.9.0"
regex = "1.11.1"
-rusqlite = { version = "0.33.0", features = ["bundled"] }
+rusqlite = { version = "0.33.0", features = [] }
rustc-hash = "2.1.1"
rustc-stable-hash = "0.1.1"
rustc-stable-hash = "0.1.2"
rustfix = { version = "0.9.0", path = "crates/rustfix" }

View File

@ -1,2 +1,2 @@
SHA512 (rustc-1.86.0-src.tar.xz) = 9ce195e24a03765f7163de16271e3d19d731d4b80fcc2bfd919106c9d42543eade018f712f6947ea3c6e57c6cb2e6841596aa668d608b8da15101a7da14f3097
SHA512 (rustc-1.87.0-src.tar.xz) = 2ef08c9be45434401f916d54b3739f52d255f8a3a4ce05a717499250c2333eeaf601f1d18085b878c027c609f44da74d0151f5bfc2c9ae1e01166919a91a1d2b
SHA512 (wasi-libc-640c0cfc19a96b099e0791824be5ef0105ce2084.tar.gz) = 7626200112b6e55567855b950baf7c9eeaf47e7de34a30eb9e8b785e0e03063197102d2f39d0846055d6aab7c06232f947a6b8af3dda62c8f02ea39d8f765a5e