Compare commits

..

48 commits

Author SHA1 Message Date
Josh Stone
a9b80468ca Use %shrink for multi-line cargo_test_skip_list
This fixes macro expansion errors on el8-era rpm.

[skip changelog]
2026-01-08 17:59:21 -08:00
Jesus Checa Hidalgo
65fd388eb7 Update rpminspect.yaml
Add known exceptions for unicode test.
2025-12-15 19:46:56 +01:00
Yaakov Selkowitz
36c15e96ee Update disable-libssh2 patch for 1.92.0 2025-12-15 00:45:10 -05:00
Jesus Checa Hidalgo
d443ef9fa3 Update to Rust 1.92.0 2025-12-11 16:57:43 +01:00
Paul Murphy
904f412226 Update to Rust 1.91.1 2025-11-10 14:30:17 -06:00
Josh Stone
ef3ce219ca Update to Rust 1.91.0 2025-10-30 11:57:25 -07:00
Josh Stone
dfeceeebed Update to Rust 1.90.0 2025-09-18 09:27:17 -07:00
Josh Stone
5337f42bfe Re-enable PGO for ppc64le 2025-08-15 14:21:43 -07:00
Paul Murphy
6c973e7ddf Enable optimized-compiler-builtins on the native compiler
With the exception of s390x which does not yet provide one.

On aarch64, this adds runtime support for LSE in outline-atomic
operations.
2025-08-14 11:04:35 -05:00
Jakub Jelen
5a638152c0 Rust-gdb and lldb require rustc to find a sysroot
otherwise it fails with

```
/usr/bin/rust-gdb: line 14: rustc: command not found
```
2025-08-07 11:43:47 -07:00
Paul Murphy
b26ae543d9 Update to Rust 1.89.0
Turn on rust.verify-llvm-ir, it would have caught the ppc64le pgo
failure when building the compiler. The only impact should be
slightly increased time to build this package.

Also, bump wasi-libc sdk to version 27.
2025-08-07 09:22:41 -05:00
Fedora Release Engineering
594464056b Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-25 12:57:01 +00:00
Josh Stone
17cb547e45 Update to Rust 1.88.0 2025-06-26 13:21:58 -07:00
Josh Stone
9786ba6ea9 Skip PGO on all ppc64le builds for now 2025-05-27 16:51:15 -07:00
Jesus Checa Hidalgo
b127903104 Update to Rust 1.87.0 2025-05-15 12:07:53 +02:00
Josh Stone
e569cda848 Fix alternative bootstrap paths
- For llvm-static, the inserted ffi block needs to be extern "C",
  and LLVM now also needs libxml2-devel for linking.
- When using upstream binaries, we should not use the rpm macros that
  pull in the system rust toolchain.

[skip changelog]
2025-04-29 13:04:03 -07:00
Josh Stone
c9224a07d6 Temporarily skip PGO on RHEL ppc64le 2025-04-24 14:15:58 -07:00
Josh Stone
3436f8c99b Update to Rust 1.86.0 2025-04-03 08:59:19 -07:00
Josh Stone
956ba8047c Update to Rust 1.85.1 2025-03-18 12:45:47 -07:00
Josh Stone
5f24112b8e Clean up LLVM-compat and enable it on ELN 2025-03-10 16:47:09 -07:00
Josh Stone
53b3e13ae5 Lock cargo to the matching rust version 2025-03-07 17:34:12 -08:00
Josh Stone
f0deba825b Add Provides: bundled(crate(_)) for vendored dependencies 2025-03-07 16:45:09 -08:00
Josh Stone
36704d2c57 ld.gold isn't needed for tests anymore 2025-02-26 12:51:03 -08:00
Josh Stone
ad5a8095c8 Update to Rust 1.85.0 2025-02-20 09:16:51 -08:00
Josh Stone
8e04e725bb Update to Rust 1.84.1 2025-01-30 12:00:33 -08:00
Josh Stone
1013e8f026 Restore libstd.so for uses like evcxr
Ref: https://github.com/evcxr/evcxr/issues/394
2025-01-27 12:19:36 -08:00
Josh Stone
780493632f Use system oniguruma for building rust-docs 2025-01-20 10:30:09 -08:00
Fedora Release Engineering
b9d8811f3b Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-19 00:20:25 +00:00
Josh Stone
17a60f7317 Fully remove the shared standard library 2025-01-14 10:03:14 -08:00
Josh Stone
81b4dce864 Revert use of clang/lld; patch cc-rs#1354 instead 2025-01-09 17:24:50 -08:00
Josh Stone
74986e8d9c Use lld when building the compiler 2025-01-09 15:04:14 -08:00
Josh Stone
27d88bb597 Update to Rust 1.84.0 2025-01-09 08:39:49 -08:00
Josh Stone
86da954d70 prep: Remove submodules we don't need. 2024-12-18 14:02:30 -08:00
Jesus Checa Hidalgo
deb8dc4f03 Update rpminspect unicode exceptions
rust 1.83.0 ships gcc source, which includes some tests for unicode
characters. This commit blacklists those tests so they won't raise
false positives in rpminspect testing.
2024-12-18 06:47:09 +00:00
David Michael
0e39664275 Put an upper bound on the cargo requirement as well
Rebuilding a previous SRPM version will fail because cargo has the
same version requirement as Rust, e.g.:

Unexpected cargo version: 1.82.0, we should use 1.79.x/1.80.1 to build source with 1.80.1
2024-12-16 15:25:36 -05:00
David Michael
ed69793c2f Move the target list definition after the rust_triple function
This has no functional effect, it is just to be nice to downstreams
for adding additional ABIs to the target list with minimal changes.
It makes macros parametric to pass parameters to the Lua function,
but this is still unused in this spec.

Also clean up the ppc64 architecture from the list since it's not
being build by ExclusiveArch anymore.

[skip changelog]
2024-12-16 15:23:51 -05:00
Josh Stone
0f308eb772 Exclude target shared libraries
Now that the compiler is linking `std` statically, we don't really need
that shared library for anything at all, so now it's excluded.
2024-12-02 16:55:24 -08:00
Josh Stone
64ec772902 Update to Rust 1.83.0 2024-11-28 06:52:10 -08:00
Josh Stone
1338df248a [eln] update to wasi-libc-24 2024-11-12 13:20:32 -08:00
Jesus Checa Hidalgo
9d72a7a9c3 Add unicode exception rules for rpminpect 2024-10-30 17:06:19 +01:00
Josh Stone
8ee6197240 Set build.jobs for everything 2024-10-29 11:05:54 -07:00
Josh Stone
5b4a0fd51a Update to Rust 1.82.0 2024-10-17 10:23:39 -07:00
Davide Cavalca
f737b8c4dd Reenable the aarch64-unknown-none-softfloat target on RHEL
This was dropped in
bdc2be1e01
but it's needed for EPEL 10, so adding it back.

Resolves: RHEL-60808

Signed-off-by: Davide Cavalca <dcavalca@centosproject.org>

(cherry picked from commit 175d35473cf8885da93bc888f7f4a54a369c84cd)
2024-10-11 18:29:44 -07:00
Josh Stone
57f6a22eea Require rust libraries for rust-analyzer; Fixes RHBZ#2316529 2024-10-08 12:44:32 -07:00
Josh Stone
06c0e45816 [eln] Upgrade wasi-libc for clang-19 2024-10-02 10:41:49 -07:00
Josh Stone
04388f6e65 Skip crash tests
[skip changelog]
2024-10-01 10:39:20 -07:00
Josh Stone
5dab1210eb Apply patches for LLVM 19 2024-09-30 11:57:52 -07:00
Josh Stone
0c755bb834 Only add an automatic SONAME for Rust dylibs
Fixes RHBZ#2314879
2024-09-30 09:50:32 -07:00
15 changed files with 513 additions and 577 deletions

17
.gitignore vendored
View file

@ -443,3 +443,20 @@
/rustc-1.81.0-src.tar.xz
/wasi-libc-b9ef79d7dbd47c6c5bafdae760823467c2f60b70.tar.gz
/rustc-1.82.0-src.tar.xz
/wasi-libc-wasi-sdk-24.tar.gz
/rustc-1.83.0-src.tar.xz
/rustc-1.84.0-src.tar.xz
/wasi-libc-wasi-sdk-25.tar.gz
/rustc-1.84.1-src.tar.xz
/rustc-1.85.0-src.tar.xz
/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
/rustc-1.88.0-src.tar.xz
/wasi-libc-wasi-sdk-27.tar.gz
/rustc-1.89.0-src.tar.xz
/rustc-1.90.0-src.tar.xz
/rustc-1.91.0-src.tar.xz
/rustc-1.91.1-src.tar.xz
/rustc-1.92.0-src.tar.xz

View file

@ -1,69 +0,0 @@
From b4b8777b049f7394fff8eefaaa3b4cb3a8f16ff4 Mon Sep 17 00:00:00 2001
From: Kyle Huey <khuey@kylehuey.com>
Date: Tue, 22 Oct 2024 10:58:56 -0700
Subject: [PATCH] Drop debug info that would conflict and trigger #131944
---
.../rustc_codegen_ssa/src/mir/debuginfo.rs | 25 +++++++++++++------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
index 75692540c034..35cb0e25b6cc 100644
--- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
@@ -448,7 +448,8 @@ pub fn compute_per_local_var_debug_info(
}
let mut per_local = IndexVec::from_elem(vec![], &self.mir.local_decls);
- let mut params_seen: FxHashMap<_, Bx::DIVariable> = Default::default();
+ let mut params_seen: FxHashMap<_, (Bx::DIVariable, Span, mir::SourceScope)> =
+ Default::default();
for var in &self.mir.var_debug_info {
let dbg_scope_and_span = if full_debug_info {
self.adjusted_span_and_dbg_scope(var.source_info)
@@ -467,7 +468,7 @@ pub fn compute_per_local_var_debug_info(
}
};
- let dbg_var = dbg_scope_and_span.map(|(dbg_scope, _, span)| {
+ let dbg_var = dbg_scope_and_span.and_then(|(dbg_scope, _, span)| {
let var_kind = if let Some(arg_index) = var.argument_index
&& var.composite.is_none()
&& let mir::VarDebugInfoContents::Place(place) = var.value
@@ -493,18 +494,28 @@ pub fn compute_per_local_var_debug_info(
VariableKind::LocalVariable
};
- if let VariableKind::ArgumentVariable(arg_index) = var_kind {
+ Some(if let VariableKind::ArgumentVariable(arg_index) = var_kind {
match params_seen.entry((dbg_scope, arg_index)) {
- Entry::Occupied(o) => o.get().clone(),
+ Entry::Occupied(o) => {
+ let (seen_var, seen_span, seen_source_scope) = o.get();
+ if *seen_span == span && *seen_source_scope != var.source_info.scope {
+ return None;
+ } else {
+ seen_var.clone()
+ }
+ }
Entry::Vacant(v) => v
- .insert(
+ .insert((
self.cx.create_dbg_var(var.name, var_ty, dbg_scope, var_kind, span),
- )
+ span,
+ var.source_info.scope,
+ ))
+ .0
.clone(),
}
} else {
self.cx.create_dbg_var(var.name, var_ty, dbg_scope, var_kind, span)
- }
+ })
});
let fragment = if let Some(ref fragment) = var.composite {
--
2.47.0

View file

@ -1,147 +0,0 @@
From c15469a7fec811d1a4f69ff26e18c6f383df41d2 Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Fri, 6 Sep 2024 09:21:33 -0700
Subject: [PATCH] Fix enabling wasm-component-ld to match other tools
It was [pointed out recently][comment] that enabling `wasm-component-ld`
as a host tool is different from other host tools. This commit refactors
the logic to match by deduplicating selection of when to build other
tools and then using the same logic for `wasm-component-ld`.
[comment]: https://github.com/rust-lang/rust/pull/127866#issuecomment-2333434720
---
src/bootstrap/src/core/build_steps/compile.rs | 2 +-
src/bootstrap/src/core/build_steps/dist.rs | 2 +-
src/bootstrap/src/core/build_steps/tool.rs | 38 +++----------------
src/bootstrap/src/lib.rs | 17 +++++----
4 files changed, 17 insertions(+), 42 deletions(-)
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 1936c91ef83c..102c9fd25543 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -1912,7 +1912,7 @@ fn run(self, builder: &Builder<'_>) -> Compiler {
// delegates to the `rust-lld` binary for linking and then runs
// logic to create the final binary. This is used by the
// `wasm32-wasip2` target of Rust.
- if builder.build_wasm_component_ld() {
+ if builder.tool_enabled("wasm-component-ld") {
let wasm_component_ld_exe =
builder.ensure(crate::core::build_steps::tool::WasmComponentLd {
compiler: build_compiler,
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index 4957de2e1b79..ccb5656d6716 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -473,7 +473,7 @@ fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) {
);
}
}
- if builder.build_wasm_component_ld() {
+ if builder.tool_enabled("wasm-component-ld") {
let src_dir = builder.sysroot_libdir(compiler, host).parent().unwrap().join("bin");
let ld = exe("wasm-component-ld", compiler.host);
builder.copy_link(&src_dir.join(&ld), &dst_dir.join(&ld));
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index 3a1eb43b801f..3c2d791c2090 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -693,14 +693,7 @@ impl Step for Cargo {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
- run.path("src/tools/cargo").default_condition(
- builder.config.extended
- && builder.config.tools.as_ref().map_or(
- true,
- // If `tools` is set, search list for this tool.
- |tools| tools.iter().any(|tool| tool == "cargo"),
- ),
- )
+ run.path("src/tools/cargo").default_condition(builder.tool_enabled("cargo"))
}
fn make_run(run: RunConfig<'_>) {
@@ -772,14 +765,7 @@ impl Step for RustAnalyzer {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
- run.path("src/tools/rust-analyzer").default_condition(
- builder.config.extended
- && builder
- .config
- .tools
- .as_ref()
- .map_or(true, |tools| tools.iter().any(|tool| tool == "rust-analyzer")),
- )
+ run.path("src/tools/rust-analyzer").default_condition(builder.tool_enabled("rust-analyzer"))
}
fn make_run(run: RunConfig<'_>) {
@@ -821,12 +807,8 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/rust-analyzer")
.path("src/tools/rust-analyzer/crates/proc-macro-srv-cli")
.default_condition(
- builder.config.extended
- && builder.config.tools.as_ref().map_or(true, |tools| {
- tools.iter().any(|tool| {
- tool == "rust-analyzer" || tool == "rust-analyzer-proc-macro-srv"
- })
- }),
+ builder.tool_enabled("rust-analyzer")
+ || builder.tool_enabled("rust-analyzer-proc-macro-srv"),
)
}
@@ -874,16 +856,8 @@ impl Step for LlvmBitcodeLinker {
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
- run.path("src/tools/llvm-bitcode-linker").default_condition(
- builder.config.extended
- && builder
- .config
- .tools
- .as_ref()
- .map_or(builder.build.unstable_features(), |tools| {
- tools.iter().any(|tool| tool == "llvm-bitcode-linker")
- }),
- )
+ run.path("src/tools/llvm-bitcode-linker")
+ .default_condition(builder.tool_enabled("llvm-bitcode-linker"))
}
fn make_run(run: RunConfig<'_>) {
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index c76ce3409562..780024e307ed 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1407,16 +1407,17 @@ fn default_wasi_runner(&self) -> Option<String> {
None
}
- /// Returns whether it's requested that `wasm-component-ld` is built as part
- /// of the sysroot. This is done either with the `extended` key in
- /// `config.toml` or with the `tools` set.
- fn build_wasm_component_ld(&self) -> bool {
- if self.config.extended {
- return true;
+ /// Returns whether the specified tool is configured as part of this build.
+ ///
+ /// This requires that both the `extended` key is set and the `tools` key is
+ /// either unset or specifically contains the specified tool.
+ fn tool_enabled(&self, tool: &str) -> bool {
+ if !self.config.extended {
+ return false;
}
match &self.config.tools {
- Some(set) => set.contains("wasm-component-ld"),
- None => false,
+ Some(set) => set.contains(tool),
+ None => true,
}
}
--
2.46.0

View file

@ -1,4 +1,4 @@
From 184d61d2c12aa2db01de9a14ccb2be0cfae5039b Mon Sep 17 00:00:00 2001
From e54c0a4cc8bd8a76b155714b23a61d1d32a8d069 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 9 Jun 2023 15:23:08 -0700
Subject: [PATCH] Let environment variables override some default CPUs
@ -10,12 +10,12 @@ Subject: [PATCH] Let environment variables override some default CPUs
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
index 194c3170e683..9806ca78297c 100644
index 9e406af53b5..9104903673f 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
@@ -2,7 +2,7 @@
@@ -4,7 +4,7 @@
pub fn target() -> Target {
pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
- base.cpu = "ppc64le".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_PPC64LE").unwrap_or("ppc64le").into();
@ -23,25 +23,25 @@ index 194c3170e683..9806ca78297c 100644
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::Inline;
diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
index 6fc410eb2235..c8f84edb9715 100644
index cdcf7d62a3e..02f24274ed2 100644
--- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
@@ -6,7 +6,7 @@ pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.endian = Endian::Big;
// z10 is the oldest CPU supported by LLVM
- base.cpu = "z10".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_S390X").unwrap_or("z10").into();
// FIXME: The ABI implementation in cabi_s390x.rs is for now hard-coded to assume the no-vector
// ABI. Pass the -vector feature string to LLVM to respect this assumption. On LLVM < 16, we
// also strip v128 from the data_layout below to match the older LLVM's expectation.
base.max_atomic_width = Some(128);
base.min_global_align = Some(Align::from_bits(16).unwrap());
base.stack_probes = StackProbeType::Inline;
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
index 80e267c163fa..8436a00e66d5 100644
index 0c8353fad18..c2515e700bb 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
@@ -2,7 +2,7 @@
@@ -4,7 +4,7 @@
pub fn target() -> Target {
pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
- base.cpu = "x86-64".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_X86_64").unwrap_or("x86-64").into();
@ -49,5 +49,5 @@ index 80e267c163fa..8436a00e66d5 100644
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
--
2.41.0
2.49.0

View file

@ -1,4 +1,4 @@
From 3d8c6d095581e8d7585f3772cfd16f6367f3c008 Mon Sep 17 00:00:00 2001
From e9405caf32dfb31bf17c3da0299df515a3755107 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 16 Aug 2024 10:12:58 -0700
Subject: [PATCH] Use lld provided by system
@ -12,12 +12,12 @@ Subject: [PATCH] Use lld provided by system
5 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/compiler/rustc_target/src/spec/base/wasm.rs b/compiler/rustc_target/src/spec/base/wasm.rs
index f237391016e7..08bcd9699b4a 100644
index 7ede45766ea..b22362227bb 100644
--- a/compiler/rustc_target/src/spec/base/wasm.rs
+++ b/compiler/rustc_target/src/spec/base/wasm.rs
@@ -85,8 +85,7 @@ macro_rules! args {
// arguments just yet
limit_rdylib_exports: false,
@@ -81,8 +81,7 @@ macro_rules! args {
// threaded model which will legalize atomics to normal operations.
singlethread: true,
- // we use the LLD shipped with the Rust toolchain by default
- linker: Some("rust-lld".into()),
@ -26,10 +26,10 @@ index f237391016e7..08bcd9699b4a 100644
pre_link_args,
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
index 222d5651b521..4b780bc8a8e7 100644
index 35a4dd72b86..a9c8fc5edb8 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
@@ -14,7 +14,7 @@ pub fn target() -> Target {
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
let opts = TargetOptions {
abi: "softfloat".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
@ -39,10 +39,10 @@ index 222d5651b521..4b780bc8a8e7 100644
relocation_model: RelocModel::Static,
disable_redzone: true,
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
index 429303170b6b..19d4ec53f6d8 100644
index 327b52389b9..17313d7e8b3 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
@@ -9,6 +9,7 @@ pub fn target() -> Target {
@@ -9,6 +9,7 @@ pub(crate) fn target() -> Target {
base.max_atomic_width = Some(128);
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/machine:arm64"]);
base.features = "+v8a".into();
@ -51,30 +51,30 @@ index 429303170b6b..19d4ec53f6d8 100644
Target {
llvm_target: "aarch64-unknown-windows".into(),
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
index 549706998d46..b7e9158ddef5 100644
index 1a6343595f5..8015b082cd1 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
@@ -17,7 +17,7 @@ pub fn target() -> Target {
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
static_position_independent_executables: true,
relro_level: RelroLevel::Full,
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
- linker: Some("rust-lld".into()),
+ linker: Some("lld".into()),
rustc_abi: Some(RustcAbi::X86Softfloat),
features: "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float".into(),
supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
disable_redzone: true,
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
index 6da1fcca58c8..c84ae44576d4 100644
index 0cf6a879462..3677fc662de 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
@@ -16,6 +16,7 @@ pub fn target() -> Target {
@@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.entry_abi = Conv::X86_64Win64;
base.entry_abi = CanonAbi::X86(X86Call::Win64);
+ base.linker = Some("lld".into());
// We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to
// enable these CPU features explicitly before their first use, otherwise their instructions
--
2.46.0
2.51.0

View file

@ -1,36 +1,34 @@
From babdaf8354098399ec98c96eb3a3627664d6ba03 Mon Sep 17 00:00:00 2001
From 8364de4cb8edab85efcb895824ce06f4a95bd26f Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:14:28 -0700
Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
Date: Mon, 18 Aug 2025 17:11:07 -0700
Subject: [PATCH] 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/core/config/config.rs | 4 ++++
src/bootstrap/src/core/config/toml/target.rs | 5 +++++
src/bootstrap/src/lib.rs | 5 +++++
4 files changed, 22 insertions(+)
5 files changed, 23 insertions(+)
diff --git a/config.example.toml b/config.example.toml
index f1dc32234ccf..82207f19d471 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -880,6 +880,11 @@
# argument as the test binary.
#runner = <none> (string)
diff --git a/bootstrap.example.toml b/bootstrap.example.toml
index 6f37e51a47d..ee21bc06bea 100644
--- a/bootstrap.example.toml
+++ b/bootstrap.example.toml
@@ -1077,3 +1077,8 @@
# pass `off`:
# - x86_64-unknown-linux-gnu
#default-linker-linux-override = "off" (for most targets)
+
+# Copy libc and CRT objects into the target lib/self-contained/ directory.
+# Enabled by default on `musl`, `wasi`, and `windows-gnu` targets. Other
+# targets may ignore this setting if they have nothing to be contained.
+#self-contained = <platform-specific> (bool)
+
# =============================================================================
# Distribution options
#
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index edf18e2ebf33..d48d027f329c 100644
index 6857a40ada8..9a98323a704 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -367,6 +367,10 @@ fn copy_self_contained_objects(
@@ -368,6 +368,10 @@ fn copy_self_contained_objects(
compiler: &Compiler,
target: TargetSelection,
) -> Vec<(PathBuf, DependencyType)> {
@ -38,24 +36,54 @@ index edf18e2ebf33..d48d027f329c 100644
+ return vec![];
+ }
+
let libdir_self_contained = builder.sysroot_libdir(*compiler, target).join("self-contained");
let libdir_self_contained =
builder.sysroot_target_libdir(*compiler, target).join("self-contained");
t!(fs::create_dir_all(&libdir_self_contained));
let mut target_deps = vec![];
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index bdfee55d8d18..47fcd50e7e03 100644
index 4b7ae6df360..6bab269a33c 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -589,6 +589,7 @@ pub struct Target {
pub runner: Option<String>,
pub no_std: bool,
pub codegen_backends: Option<Vec<String>>,
@@ -864,6 +864,7 @@ pub(crate) fn parse_inner(
runner: target_runner,
optimized_compiler_builtins: target_optimized_compiler_builtins,
jemalloc: target_jemalloc,
+ self_contained: target_self_contained
} = cfg;
let mut target = Target::from_triple(&triple);
@@ -921,6 +922,9 @@ pub(crate) fn parse_inner(
if let Some(s) = target_no_std {
target.no_std = s;
}
+ if let Some(s) = target_self_contained {
+ target.self_contained = s;
+ }
target.cc = target_cc.map(PathBuf::from);
target.cxx = target_cxx.map(PathBuf::from);
target.ar = target_ar.map(PathBuf::from);
diff --git a/src/bootstrap/src/core/config/toml/target.rs b/src/bootstrap/src/core/config/toml/target.rs
index 4c7afa50b96..83b8a1b50ca 100644
--- a/src/bootstrap/src/core/config/toml/target.rs
+++ b/src/bootstrap/src/core/config/toml/target.rs
@@ -47,6 +47,7 @@ struct TomlTarget {
runner: Option<String> = "runner",
optimized_compiler_builtins: Option<CompilerBuiltins> = "optimized-compiler-builtins",
jemalloc: Option<bool> = "jemalloc",
+ self_contained: Option<bool> = "self-contained",
}
}
@@ -80,6 +81,7 @@ pub struct Target {
pub codegen_backends: Option<Vec<CodegenBackendKind>>,
pub optimized_compiler_builtins: Option<CompilerBuiltins>,
pub jemalloc: Option<bool>,
+ pub self_contained: bool,
}
impl Target {
@@ -597,6 +598,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") {
target.no_std = true;
@@ -91,6 +93,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("emscripten") {
target.runner = Some("node".into());
}
+ if triple.contains("-musl") || triple.contains("-wasi") || triple.contains("-windows-gnu") {
+ target.self_contained = true;
@ -63,29 +91,11 @@ index bdfee55d8d18..47fcd50e7e03 100644
target
}
}
@@ -1165,6 +1169,7 @@ struct TomlTarget {
no_std: Option<bool> = "no-std",
codegen_backends: Option<Vec<String>> = "codegen-backends",
runner: Option<String> = "runner",
+ self_contained: Option<bool> = "self-contained",
}
}
@@ -1967,6 +1972,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
if let Some(s) = cfg.no_std {
target.no_std = s;
}
+ if let Some(s) = cfg.self_contained {
+ target.self_contained = s;
+ }
target.cc = cfg.cc.map(PathBuf::from);
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 82b640f54234..f724aba50241 100644
index dd30f05b728..cc89a84071e 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1326,6 +1326,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
@@ -1441,6 +1441,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
self.config.target_config.get(&target).map(|t| t.no_std)
}
@ -98,5 +108,5 @@ index 82b640f54234..f724aba50241 100644
/// and `remote-test-server` binaries.
fn remote_tested(&self, target: TargetSelection) -> bool {
--
2.46.0
2.51.0

View file

@ -0,0 +1,28 @@
From 7d83bae4e2577ffa2afaf2fddb6948c1756a403c Mon Sep 17 00:00:00 2001
From: Paul Murphy <paumurph@redhat.com>
Date: Thu, 10 Jul 2025 09:06:22 -0500
Subject: [PATCH] only copy rustlib into stage0 sysroot
Otherwise, much more is copied, and doing so likely runs into
permissions errors if the bootstrap toolchain lives in the host's
sysroot.
---
src/bootstrap/src/core/build_steps/compile.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 4d0ae54e1ef..4ef70dd9b97 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -811,7 +811,7 @@ fn run(self, builder: &Builder<'_>) {
let _ = fs::remove_dir_all(sysroot.join("lib/rustlib/src/rust"));
}
- builder.cp_link_r(&builder.initial_sysroot.join("lib"), &sysroot.join("lib"));
+ builder.cp_link_r(&builder.initial_sysroot.join("lib/rustlib"), &sysroot.join("lib/rustlib"));
} else {
if builder.download_rustc() {
// Ensure there are no CI-rustc std artifacts.
--
2.49.0

View file

@ -1,19 +1,20 @@
From 3fdce19416e80a48c5b2b77b2cdec697d0b5e225 Mon Sep 17 00:00:00 2001
From 862d09fe2e8b0f5ce8fe7bfc592cda66a1d74c08 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:18:16 -0700
Date: Mon, 18 Aug 2025 17:13:28 -0700
Subject: [PATCH 2/2] set an external library path for wasm32-wasi
---
compiler/rustc_codegen_ssa/src/back/link.rs | 10 ++++++++++
compiler/rustc_target/src/spec/mod.rs | 4 ++++
compiler/rustc_target/src/spec/json.rs | 4 ++++
compiler/rustc_target/src/spec/mod.rs | 2 ++
.../rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++---
3 files changed, 18 insertions(+), 3 deletions(-)
4 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index e8143b9a5f38..5a928a18b3ea 100644
index 48b01ea2df19..59b87396fed2 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1621,6 +1621,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
@@ -1559,6 +1559,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
return file_path;
}
}
@ -23,13 +24,13 @@ index e8143b9a5f38..5a928a18b3ea 100644
+ return file_path;
+ }
+ }
for search_path in sess.target_filesearch(PathKind::Native).search_paths() {
for search_path in sess.target_filesearch().search_paths(PathKind::Native) {
let file_path = search_path.dir.join(name);
if file_path.exists() {
@@ -2123,6 +2129,10 @@ fn add_library_search_dirs(
ControlFlow::<()>::Continue(())
},
);
@@ -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()));
@ -37,35 +38,19 @@ index e8143b9a5f38..5a928a18b3ea 100644
}
/// Add options making relocation sections in the produced ELF files read-only
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index d5f227a84a4c..54c22c8ebed6 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -2053,6 +2053,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects,
+ pub external_lib_path: Option<StaticCow<str>>,
/// 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,
@@ -2540,6 +2541,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None,
pre_link_objects: Default::default(),
post_link_objects: Default::default(),
+ external_lib_path: None,
pre_link_objects_self_contained: Default::default(),
post_link_objects_self_contained: Default::default(),
link_self_contained: LinkSelfContainedDefault::False,
@@ -3221,6 +3223,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);
+ key!(external_lib_path, optional);
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`
@@ -3482,6 +3485,7 @@ macro_rules! target_option_val {
diff --git a/compiler/rustc_target/src/spec/json.rs b/compiler/rustc_target/src/spec/json.rs
index f236be92b3b6..eea6e0c203d2 100644
--- a/compiler/rustc_target/src/spec/json.rs
+++ b/compiler/rustc_target/src/spec/json.rs
@@ -81,6 +81,7 @@ macro_rules! forward_opt {
forward!(linker_is_gnu_json);
forward!(pre_link_objects);
forward!(post_link_objects);
+ forward_opt!(external_lib_path);
forward!(pre_link_objects_self_contained);
forward!(post_link_objects_self_contained);
@@ -301,6 +302,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);
@ -73,13 +58,42 @@ index d5f227a84a4c..54c22c8ebed6 100644
target_option_val!(pre_link_objects_self_contained, "pre-link-objects-fallback");
target_option_val!(post_link_objects_self_contained, "post-link-objects-fallback");
target_option_val!(link_args - pre_link_args_json, "pre-link-args");
@@ -511,6 +513,8 @@ struct TargetSpecJson {
pre_link_objects: Option<CrtObjects>,
#[serde(rename = "post-link-objects")]
post_link_objects: Option<CrtObjects>,
+ #[serde(rename = "external-lib-path")]
+ external_lib_path: Option<StaticCow<str>>,
#[serde(rename = "pre-link-objects-fallback")]
pre_link_objects_self_contained: Option<CrtObjects>,
#[serde(rename = "post-link-objects-fallback")]
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 07fb1ce63f7c..c076c2836f84 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1992,6 +1992,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects,
+ pub external_lib_path: Option<StaticCow<str>>,
/// 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,
@@ -2518,6 +2519,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None,
pre_link_objects: Default::default(),
post_link_objects: Default::default(),
+ external_lib_path: None,
pre_link_objects_self_contained: Default::default(),
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 29e6dff2068f..dbe021ef064c 100644
index 26add451ed25..3eaf050e6823 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 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-wasi"]);
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasip1"]);
- options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
- options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
@ -94,5 +108,5 @@ index 29e6dff2068f..dbe021ef064c 100644
// Right now this is a bit of a workaround but we're currently saying that
// the target by default has a static crt which we're taking as a signal
--
2.46.0
2.51.0

View file

@ -6,3 +6,22 @@ debuginfo:
# https://github.com/rust-lang/rust/issues/45854
- /usr/lib/debug/usr/bin/rustc-*.i386.debug
unicode:
ignore:
# These files are known to contain forbidden unicode chars as
# they are tests for those.
- rustc-*-src/tests/ui/lint/issue-90614-accept-allow-text-direction-codepoint-in-comment-lint.rs
- rustc-*-src/tests/ui/parser/unicode-control-codepoints.rs
- rustc-*-src/tests/ui/parser/macro/unicode-control-codepoints-macros.rs
- rustc-*-src/tests/ui/parser/macro/auxiliary/unicode-control.rs
- rustc-*-src/compiler/rustc_lint/src/hidden_unicode_codepoints.rs
- rustc-*-src/compiler/rustc_lint_defs/src/builtin.rs
- rustc-*-src/vendor/idna/tests/IdnaTestV2.txt
- rustc-*-src/vendor/idna-*/tests/IdnaTestV2.txt
- rustc-*-src/vendor/mdbook*/tests/testsuite/search/reasonable_search_index/expected_index.js
- rustc-*-src/vendor/mdbook*/tests/testsuite/search/reasonable_search_index/src/first/unicode.md
- rustc-*-src/vendor/wast-*/tests/parse-fail/confusing-string?.wat
- rustc-*-src/vendor/wast-*/tests/parse-fail/confusing-block-comment?.wat
- rustc-*-src/vendor/wast-*/tests/parse-fail/confusing-line-comment?.wat
- rustc-*-src/src/llvm-project/clang-tools-extra/docs/clang-tidy/checks/misc/misleading-bidirectional.rst
- rustc-*-src/src/gcc/gcc/testsuite/c-c++-common/*Wbidi*.c

400
rust.spec
View file

@ -1,8 +1,8 @@
Name: rust
Version: 1.82.0
Release: 1%{?dist}
Version: 1.92.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-DFS-2016)
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)
# ^ written as: (rust itself) and (bundled libraries)
URL: https://www.rust-lang.org
@ -11,12 +11,12 @@ URL: https://www.rust-lang.org
%global rust_arches x86_64 i686 armv7hl aarch64 ppc64le s390x riscv64
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
# To bootstrap from scratch, set the channel and date from src/stage0
# e.g. 1.89.0 wants rustc: 1.88.0-2025-06-26
# or nightly wants some beta-YYYY-MM-DD
%global bootstrap_version 1.81.0
%global bootstrap_channel 1.81.0
%global bootstrap_date 2024-09-05
%global bootstrap_version 1.91.0
%global bootstrap_channel 1.91.0
%global bootstrap_date 2025-10-30
# Only the specified arches will use bootstrap binaries.
# NOTE: Those binaries used to be uploaded with every new release, but that was
@ -25,41 +25,10 @@ ExclusiveArch: %{rust_arches}
# add them to sources. Remember to remove them again after the bootstrap build!
#global bootstrap_arches %%{rust_arches}
# Define a space-separated list of targets to ship rust-std-static-$triple for
# cross-compilation. The packages are noarch, but they're not fully
# reproducible between hosts, so only x86_64 actually builds it.
%ifarch x86_64
%if 0%{?fedora}
%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu
%endif
# NB: wasm32-wasi is being gradually replaced by wasm32-wasip1
# https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
%global wasm_targets wasm32-unknown-unknown wasm32-wasi wasm32-wasip1
%if 0%{?fedora}
%global extra_targets x86_64-unknown-none x86_64-unknown-uefi
%endif
%if 0%{?rhel} >= 10
%global extra_targets x86_64-unknown-none
%endif
%endif
%ifarch aarch64
%if 0%{?fedora}
%global extra_targets aarch64-unknown-none-softfloat aarch64-unknown-uefi
%endif
%if 0%{?rhel} >= 10
%global extra_targets aarch64-unknown-none-softfloat
%endif
%endif
%global all_targets %{?mingw_targets} %{?wasm_targets} %{?extra_targets}
%define target_enabled() %{lua:
print(string.find(rpm.expand(" %{all_targets} "), rpm.expand(" %1 "), 1, true) or 0)
}
# We need CRT files for *-wasi targets, at least as new as the commit in
# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
%global wasi_libc_url https://github.com/WebAssembly/wasi-libc
#global wasi_libc_ref wasi-sdk-24
%global wasi_libc_ref b9ef79d7dbd47c6c5bafdae760823467c2f60b70
%global wasi_libc_ref wasi-sdk-27
%global wasi_libc_name wasi-libc-%{wasi_libc_ref}
%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_ref}/%{wasi_libc_name}.tar.gz
%global wasi_libc_dir %{_builddir}/%{wasi_libc_name}
@ -73,27 +42,37 @@ ExclusiveArch: %{rust_arches}
%bcond_with llvm_static
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 17.0+.
%global min_llvm_version 17.0.0
%global bundled_llvm_version 19.1.1
#global llvm_compat_version 17
# is insufficient. Rust currently requires LLVM 19.0+.
# See src/bootstrap/src/core/build_steps/llvm.rs, fn check_llvm_version
%global min_llvm_version 20.0.0
%global bundled_llvm_version 21.1.3
#global llvm_compat_version 19
%global llvm llvm%{?llvm_compat_version}
%bcond_with bundled_llvm
# Requires stable libgit2 1.8, and not the next minor soname change.
# Requires stable libgit2 1.9, and not the next minor soname change.
# This needs to be consistent with the bindings in vendor/libgit2-sys.
%global min_libgit2_version 1.8.1
%global next_libgit2_version 1.9.0~
%global bundled_libgit2_version 1.8.1
%global min_libgit2_version 1.9.0
%global next_libgit2_version 1.10.0~
%global bundled_libgit2_version 1.9.1
%if 0%{?fedora} >= 41
%bcond_with bundled_libgit2
%else
%bcond_without bundled_libgit2
%endif
# Try to use system oniguruma (only used at build time for rust-docs)
# src/tools/rustbook -> ... -> onig_sys v69.9.1 needs at least 6.9.3
%global min_oniguruma_version 6.9.3
%if 0%{?rhel} && 0%{?rhel} < 9
%bcond_without bundled_oniguruma
%else
%bcond_with bundled_oniguruma
%endif
# Cargo uses UPSERTs with omitted conflict targets
%global min_sqlite3_version 3.35
%global bundled_sqlite3_version 3.46.0
%global bundled_sqlite3_version 3.50.2
%if 0%{?rhel} && 0%{?rhel} < 10
%bcond_without bundled_sqlite3
%else
@ -134,7 +113,7 @@ ExclusiveArch: %{rust_arches}
# Detect non-stable channels from the version, like 1.74.0~beta.1
%{lua: do
local version = rpm.expand("%{version}")
local version_channel, subs = string.gsub(version, "^.*~(%w+).*$", "%1", 1)
local version_channel, subs = version:gsub("^.*~(%w+).*$", "%1", 1)
rpm.define("channel " .. (subs ~= 0 and version_channel or "stable"))
rpm.define("rustc_package rustc-" .. version_channel .. "-src")
end}
@ -159,13 +138,10 @@ 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.82.0-unbundle-sqlite.patch
Patch6: rustc-1.92.0-unbundle-sqlite.patch
# https://github.com/rust-lang/rust/pull/130034
Patch7: 0001-Fix-enabling-wasm-component-ld-to-match-other-tools.patch
# https://github.com/rust-lang/rust/issues/131944#issuecomment-2428361518
Patch8: 0001-Drop-debug-info-that-would-conflict-and-trigger-1319.patch
# stage0 tries to copy all of /usr/lib, sometimes unsuccessfully, see #143735
Patch7: 0001-only-copy-rustlib-into-stage0-sysroot.patch
### RHEL-specific patches below ###
@ -176,16 +152,14 @@ Source102: cargo_vendor.attr
Source103: cargo_vendor.prov
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
Patch100: rustc-1.82.0-disable-libssh2.patch
Patch100: rustc-1.92.0-disable-libssh2.patch
# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
local abi = "gnu"
# Get the Rust triple for any architecture and ABI.
%{lua: function rust_triple(arch, abi)
abi = abi or "gnu"
if arch == "armv7hl" then
arch = "armv7"
abi = "gnueabihf"
elseif arch == "ppc64" then
arch = "powerpc64"
abi = abi.."eabihf"
elseif arch == "ppc64le" then
arch = "powerpc64le"
elseif arch == "riscv64" then
@ -194,11 +168,42 @@ Patch100: rustc-1.82.0-disable-libssh2.patch
return arch.."-unknown-linux-"..abi
end}
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
%define rust_triple() %{lua: print(rust_triple(
rpm.expand("%{?1}%{!?1:%{_target_cpu}}"),
rpm.expand("%{?2}%{!?2:gnu}")
))}
# Get the environment form of the Rust triple
%global rust_triple_env %{lua:
print(string.upper(string.gsub(rpm.expand("%{rust_triple}"), "-", "_")))
# Get the environment variable form of the Rust triple.
%define rust_triple_env() %{lua:
print(rpm.expand("%{rust_triple %*}"):gsub("-", "_"):upper())
}
# Define a space-separated list of targets to ship rust-std-static-$triple for
# cross-compilation. The packages are noarch, but they're not fully
# reproducible between hosts, so only x86_64 actually builds it.
%ifarch x86_64
%if 0%{?fedora}
%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu
%endif
%global wasm_targets wasm32-unknown-unknown wasm32-wasip1
%if 0%{?fedora}
%global extra_targets x86_64-unknown-none x86_64-unknown-uefi
%endif
%if 0%{?rhel} >= 10
%global extra_targets x86_64-unknown-none
%endif
%endif
%ifarch aarch64
%if 0%{?fedora}
%global extra_targets aarch64-unknown-none-softfloat aarch64-unknown-uefi
%endif
%if 0%{?rhel} >= 10
%global extra_targets aarch64-unknown-none-softfloat
%endif
%endif
%global all_targets %{?mingw_targets} %{?wasm_targets} %{?extra_targets}
%define target_enabled() %{lua:
print(rpm.expand(" %{all_targets} "):find(rpm.expand(" %1 "), 1, true) or 0)
}
%if %defined bootstrap_arches
@ -206,7 +211,7 @@ end}
# Also define bootstrap_source just for the current target.
%{lua: do
local bootstrap_arches = {}
for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do
for arch in rpm.expand("%{bootstrap_arches}"):gmatch("%S+") do
table.insert(bootstrap_arches, arch)
end
local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}")
@ -232,7 +237,7 @@ end}
%global local_rust_root %{_builddir}/rust-%{bootstrap_suffix}
Provides: bundled(%{name}-bootstrap) = %{bootstrap_version}
%else
BuildRequires: cargo >= %{bootstrap_version}
BuildRequires: (cargo >= %{bootstrap_version} with cargo <= %{version})
BuildRequires: (%{name} >= %{bootstrap_version} with %{name} <= %{version})
%global local_rust_root %{_prefix}
%endif
@ -252,6 +257,10 @@ BuildRequires: pkgconfig(zlib)
BuildRequires: (pkgconfig(libgit2) >= %{min_libgit2_version} with pkgconfig(libgit2) < %{next_libgit2_version})
%endif
%if %{without bundled_oniguruma}
BuildRequires: pkgconfig(oniguruma) >= %{min_oniguruma_version}
%endif
%if %{without bundled_sqlite3}
BuildRequires: pkgconfig(sqlite3) >= %{min_sqlite3_version}
%endif
@ -275,6 +284,7 @@ Provides: bundled(llvm) = %{bundled_llvm_version}
BuildRequires: cmake >= 3.5.1
%if %defined llvm_compat_version
%global llvm_root %{_libdir}/%{llvm}
%global llvm_path %{llvm_root}/bin
%else
%global llvm_root %{_prefix}
%endif
@ -282,6 +292,7 @@ BuildRequires: %{llvm}-devel >= %{min_llvm_version}
%if %with llvm_static
BuildRequires: %{llvm}-static
BuildRequires: libffi-devel
BuildRequires: libxml2-devel
%endif
%endif
@ -291,19 +302,13 @@ BuildRequires: procps-ng
# debuginfo-gdb tests need gdb
BuildRequires: gdb
# Work around https://bugzilla.redhat.com/show_bug.cgi?id=2275274:
# gdb currently prints a "Unable to load 'rpm' module. Please install the python3-rpm package."
# gdb currently prints a "Unable to load 'rpm' module. Please install the python3-rpm package."
# message that breaks version detection.
BuildRequires: python3-rpm
# For src/test/run-make/static-pie
BuildRequires: glibc-static
# For tests/run-make/pgo-branch-weights
# riscv64 does not support binutils-gold yet
%ifnarch riscv64
BuildRequires: binutils-gold
%endif
# Virtual provides for folks who attempt "dnf install rustc"
Provides: rustc = %{version}-%{release}
Provides: rustc%{?_isa} = %{version}-%{release}
@ -311,7 +316,7 @@ Provides: rustc%{?_isa} = %{version}-%{release}
# Always require our exact standard library
Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
# The C compiler is needed at runtime just for linking. Someday rustc might
# The C compiler is needed at runtime just for linking. Someday rustc might
# invoke the linker directly, and then we'll only need binutils.
# https://github.com/rust-lang/rust/issues/11937
Requires: /usr/bin/cc
@ -338,12 +343,6 @@ Requires: /usr/bin/cc
%global __brp_strip_static_archive %{nil}
%global __brp_strip_lto %{nil}
%if %{without bundled_llvm}
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1}
%global llvm_has_filecheck 1
%endif
%endif
# We're going to override --libdir when configuring to get rustlib into a
# common path, but we'll fix the shared libraries during install.
%global common_libdir %{_prefix}/lib
@ -362,11 +361,11 @@ BuildRequires: mingw64-winpthreads-static
%if %defined wasm_targets
%if %with bundled_wasi_libc
BuildRequires: clang
BuildRequires: clang%{?llvm_compat_version}
%else
BuildRequires: wasi-libc-static
%endif
BuildRequires: lld
BuildRequires: lld%{?llvm_compat_version}
%endif
# For profiler_builtins
@ -376,6 +375,32 @@ BuildRequires: compiler-rt%{?llvm_compat_version}
# https://github.com/rust-lang/rust/pull/101841
Obsoletes: %{name}-analysis < 1.69.0~
# Experimenting with a fine-grained version of %%cargo_vendor_manifest,
# so we can have different bundled provides for each tool subpackage.
%define cargo_tree_manifest(n:m:f:t:) ( \
%{!-n:%{error:must specify a tool name}} \
set -euo pipefail \
mkdir -p build/manifests/%{-n*} \
%{shrink: \
env RUSTC_BOOTSTRAP=1 \
RUSTC=%{local_rust_root}/bin/rustc \
%{local_rust_root}/bin/cargo tree \
--offline --edges normal,build \
--prefix none --format "{p}" \
%{-m:--manifest-path %{-m*}/Cargo.toml} \
%{-f:--features %{-f*}} \
%{-t:--target %{-t*}} \
%* \
| sed '/([*/]/d; s/ (proc-macro)$//' \
| sort -u \
>build/manifests/%{-n*}/cargo-vendor.txt \
} \
)
%ifnarch %{bootstrap_arches}
%{?fedora:BuildRequires: cargo-rpm-macros}
%{?rhel:BuildRequires: rust-toolset}
%endif
%description
Rust is a systems programming language that runs blazingly fast, prevents
segfaults, and guarantees thread safety.
@ -432,18 +457,6 @@ BuildArch: noarch
%target_description wasm32-unknown-unknown WebAssembly
%endif
%if %target_enabled wasm32-wasi
%target_package wasm32-wasi
Requires: lld >= 8.0
%if %with bundled_wasi_libc
Provides: bundled(wasi-libc)
%else
Requires: wasi-libc-static
%endif
BuildArch: noarch
%target_description wasm32-wasi WebAssembly
%endif
%if %target_enabled wasm32-wasip1
%target_package wasm32-wasip1
Requires: lld >= 8.0
@ -453,6 +466,8 @@ Provides: bundled(wasi-libc)
Requires: wasi-libc-static
%endif
BuildArch: noarch
# https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
Obsoletes: %{name}-std-static-wasm32-wasi < 1.84.0~
%target_description wasm32-wasip1 WebAssembly
%endif
@ -494,6 +509,8 @@ Summary: GDB pretty printers for Rust
BuildArch: noarch
Requires: gdb
Requires: %{name}-debugger-common = %{version}-%{release}
# rust-gdb uses rustc to find the sysroot
Requires: %{name} = %{version}-%{release}
%description gdb
This package includes the rust-gdb script, which allows easier debugging of Rust
@ -506,6 +523,8 @@ BuildArch: noarch
Requires: lldb
Requires: python3-lldb
Requires: %{name}-debugger-common = %{version}-%{release}
# rust-lldb uses rustc to find the sysroot
Requires: %{name} = %{version}-%{release}
%description lldb
This package includes the rust-lldb script, which allows easier debugging of Rust
@ -540,10 +559,11 @@ Provides: bundled(sqlite) = %{bundled_sqlite3_version}
%endif
# For tests:
BuildRequires: git-core
# Cargo is not much use without Rust
Requires: %{name}
# Cargo is not much use without Rust, and it's worth keeping the versions
# in sync since some feature development depends on them together.
Requires: %{name} = %{version}-%{release}
# "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and
# "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and
# Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too
Obsoletes: cargo-vendor <= 0.1.23
Provides: cargo-vendor = %{version}-%{release}
@ -609,7 +629,7 @@ BuildArch: noarch
Recommends: %{name}-std-static = %{version}-%{release}
%description src
This package includes source files for the Rust standard library. It may be
This package includes source files for the Rust standard library. It may be
useful as a reference for code completion tools in various editors.
@ -674,7 +694,6 @@ rm -rf %{wasi_libc_dir}/dlmalloc/
%patch -P6 -p1
%endif
%patch -P7 -p1
%patch -P8 -p1
%if %with disabled_libssh2
%patch -P100 -p1
@ -691,6 +710,10 @@ rm -rf src/llvm-project/
mkdir -p src/llvm-project/libunwind/
%endif
# Remove submodules we don't need.
rm -rf src/gcc
rm -rf src/tools/enzyme
rm -rf src/tools/rustc-perf/collector/*-benchmarks/
# Remove other unused vendored libraries. This leaves the directory in place,
# because some build scripts watch them, e.g. "cargo:rerun-if-changed=curl".
@ -709,6 +732,10 @@ mkdir -p src/llvm-project/libunwind/
%clear_dir vendor/libgit2-sys*/libgit2/
%endif
%if %without bundled_oniguruma
%clear_dir vendor/onig_sys*/oniguruma/
%endif
%if %without bundled_sqlite3
%clear_dir vendor/libsqlite3-sys*/sqlite3/
%endif
@ -723,12 +750,12 @@ sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/src/core/build_steps/tool.rs
%if %{without bundled_llvm} && %{with llvm_static}
# Static linking to distro LLVM needs to add -lffi
# https://github.com/rust-lang/rust/issues/34486
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
sed -i.ffi -e '$a #[link(name = "ffi")] extern "C" {}' \
compiler/rustc_llvm/src/lib.rs
%endif
# The configure macro will modify some autoconf-related files, which upsets
# cargo when it tries to verify checksums in those files. If we just truncate
# cargo when it tries to verify checksums in those files. If we just truncate
# that file list, cargo won't have anything to complain about.
find vendor -name .cargo-checksum.json \
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
@ -761,8 +788,10 @@ end}
%global rust_env %{shrink:
%{?rustflags:RUSTFLAGS="%{rustflags}"}
%{rustc_target_cpus}
%{!?with_bundled_oniguruma:RUSTONIG_SYSTEM_LIBONIG=1}
%{!?with_bundled_sqlite3:LIBSQLITE3_SYS_USE_PKG_CONFIG=1}
%{!?with_disabled_libssh2:LIBSSH2_SYS_USE_PKG_CONFIG=1}
%{?llvm_path:PATH="%{llvm_path}:$PATH"}
}
%global export_rust_env export %{rust_env}
@ -771,11 +800,22 @@ end}
# Some builders have relatively little memory for their CPU count.
# At least 4GB per CPU is a good rule of thumb for building rustc.
ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN)
max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 4 ))
if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then
ncpus="$max_cpus"
fi
%if %undefined constrain_build
%define constrain_build(m:) %{lua:
for l in io.lines('/proc/meminfo') do
if l:sub(1, 9) == "MemTotal:" then
local opt_m = math.tointeger(rpm.expand("%{-m*}"))
local mem_total = math.tointeger(string.match(l, "MemTotal:%s+(%d+)"))
local cpu_limit = math.max(1, mem_total // (opt_m * 1024))
if cpu_limit < math.tointeger(rpm.expand("%_smp_build_ncpus")) then
rpm.define("_smp_build_ncpus " .. cpu_limit)
end
break
end
end
}
%endif
%constrain_build -m 4096
%if %defined mingw_targets
%define mingw_target_config %{shrink:
@ -795,36 +835,32 @@ fi
%if %defined wasm_targets
%if %with bundled_wasi_libc
%define wasi_libc_flags MALLOC_IMPL=emmalloc CC=clang AR=llvm-ar NM=llvm-nm
%make_build --quiet -C %{wasi_libc_dir} %{wasi_libc_flags} TARGET_TRIPLE=wasm32-wasi
%make_build --quiet -C %{wasi_libc_dir} %{wasi_libc_flags} TARGET_TRIPLE=wasm32-wasip1
%define wasm_target_config %{shrink:
--set target.wasm32-wasi.wasi-root=%{wasi_libc_dir}/sysroot
--set target.wasm32-wasip1.wasi-root=%{wasi_libc_dir}/sysroot
}
%else
%define wasm_target_config %{shrink:
--set target.wasm32-wasi.wasi-root=%{_prefix}/wasm32-wasi
--set target.wasm32-wasi.self-contained=false
--set target.wasm32-wasip1.wasi-root=%{_prefix}/wasm32-wasi
--set target.wasm32-wasip1.self-contained=false
}
%endif
%endif
# Find the compiler-rt library for the Rust profiler_builtins crate.
%if %defined llvm_compat_version
# clang_resource_dir is not defined for compat builds.
%define profiler /usr/lib/clang/%{llvm_compat_version}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a
%else
%if 0%{?clang_major_version} >= 17
%define profiler %{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a
%else
# The exact profiler path is version dependent..
%define profiler %(echo %{_libdir}/clang/??/lib/libclang_rt.profile-*.a)
%endif
%endif
# Find the compiler-rt library for the Rust profiler_builtins and optimized-builtins crates.
%define clang_lib %{expand:%%clang%{?llvm_compat_version}_resource_dir}/lib
%define profiler %{clang_lib}/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a
test -r "%{profiler}"
# llvm < 21 does not provide a builtins library for s390x.
%if "%{_arch}" != "s390x" || 0%{?clang_major_version} >= 21
%define optimized_builtins %{clang_lib}/%{_arch}-redhat-linux-gnu/libclang_rt.builtins.a
test -r "%{optimized_builtins}"
%else
%define optimized_builtins false
%endif
%configure --disable-option-checking \
--docdir=%{_pkgdocdir} \
--libdir=%{common_libdir} \
@ -835,13 +871,13 @@ test -r "%{profiler}"
--set target.%{rust_triple}.ar=%{__ar} \
--set target.%{rust_triple}.ranlib=%{__ranlib} \
--set target.%{rust_triple}.profiler="%{profiler}" \
--set target.%{rust_triple}.optimized-compiler-builtins="%{optimized_builtins}" \
%{?mingw_target_config} \
%{?wasm_target_config} \
--python=%{__python3} \
--local-rust-root=%{local_rust_root} \
--set build.rustfmt=/bin/true \
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
%{!?llvm_has_filecheck: --disable-codegen-tests} \
%{!?with_llvm_static: --enable-llvm-link-shared } } \
--disable-llvm-static-stdcpp \
--disable-llvm-bitcode-linker \
@ -849,13 +885,16 @@ test -r "%{profiler}"
--disable-rpath \
%{enable_debuginfo} \
%{enable_rust_opts} \
--set build.jobs=%_smp_build_ncpus \
--set build.build-stage=2 \
--set build.doc-stage=2 \
--set build.install-stage=2 \
--set build.test-stage=2 \
--set build.optimized-compiler-builtins=false \
--set rust.llvm-tools=false \
--set rust.verify-llvm-ir=true \
--enable-extended \
--tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \
--tools=cargo,clippy,rust-analyzer,rustdoc,rustfmt,src \
--enable-vendor \
--enable-verbose-tests \
--release-channel=%{channel} \
@ -863,26 +902,28 @@ test -r "%{profiler}"
%global __x %{__python3} ./x.py
%ifnarch ppc64le
%if %with rustc_pgo
%if %{with rustc_pgo}
# Build the compiler with profile instrumentation
%define profraw $PWD/build/profiles
%define profdata $PWD/build/rustc.profdata
mkdir -p "%{profraw}"
%{__x} build -j "$ncpus" sysroot --rust-profile-generate="%{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_root}/bin/llvm-profdata merge -o "%{profdata}" "%{profraw}"
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
# Build the compiler normally (with or without PGO)
%{__x} build -j "$ncpus" sysroot
%{__x} build sysroot
# Build everything else normally
%{__x} build
@ -892,6 +933,21 @@ for triple in %{?all_targets} ; do
%{__x} build --target=$triple std
done
# Collect cargo-vendor.txt for each tool and std
%{cargo_tree_manifest -n rustc -- -p rustc-main -p rustdoc}
%{cargo_tree_manifest -n cargo -m src/tools/cargo}
%{cargo_tree_manifest -n clippy -m src/tools/clippy}
%{cargo_tree_manifest -n rust-analyzer -m src/tools/rust-analyzer}
%{cargo_tree_manifest -n rustfmt -m src/tools/rustfmt}
%{cargo_tree_manifest -n std -m library -f backtrace}
for triple in %{?all_targets} ; do
case $triple in
*-none*) %{cargo_tree_manifest -n std-$triple -m library/alloc -t $triple} ;;
*) %{cargo_tree_manifest -n std-$triple -m library -f backtrace -t $triple} ;;
esac
done
%install
%if 0%{?rhel} && 0%{?rhel} <= 9
%{?set_build_flags}
@ -904,16 +960,13 @@ 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/
# Some of the components duplicate-install binaries, leaving backups we don't want
rm -f %{buildroot}%{_bindir}/*.old
# Make sure the shared libraries are in the proper libdir
# Make sure the compiler's shared libraries are in the proper libdir
%if "%{_libdir}" != "%{common_libdir}"
mkdir -p %{buildroot}%{_libdir}
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
@ -924,18 +977,12 @@ find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
-exec chmod -v +x '{}' '+'
# The libdir libraries are identical to those under rustlib/. It's easier on
# library loading if we keep them in libdir, but we do need them in rustlib/
# to support dynamic linking for compiler plugins, so we'll symlink.
find %{buildroot}%{rustlibdir}/%{rust_triple}/lib/ -maxdepth 1 -type f -name '*.so' |
while read lib; do
lib2="%{buildroot}%{_libdir}/${lib##*/}"
if [ -f "$lib2" ]; then
# make sure they're actually identical!
cmp "$lib" "$lib2"
ln -v -f -r -s -T "$lib2" "$lib"
fi
done
# The shared standard library is excluded from Provides, because it has no
# stable ABI. However, we still ship it alongside the static target libraries
# to enable some niche local use-cases, like the `evcxr` REPL.
# Make sure those libraries are also executable for debuginfo extraction.
find %{buildroot}%{rustlibdir} -type f -name '*.so' \
-exec chmod -v +x '{}' '+'
# Remove installer artifacts (manifests, uninstall scripts, etc.)
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
@ -1017,9 +1064,29 @@ rm -rf "$TMP_HELLO"
%{__x} test --no-fail-fast --skip={src/bootstrap,tests/crashes} || :
rm -rf "./build/%{rust_triple}/test/"
# Cargo tests skip list
# Every test skipped here must have a documented reason to be skipped.
# Duplicates are safe to add.
# This test relies on the DNS to fail to resolve the host. DNS is not enabled
# in mock in koji so the DNS resolution doesn't take place to begin with.
# We test this after packaging
%global cargo_test_skip_list net_err_suggests_fetch_with_cli
%ifarch aarch64
# https://github.com/rust-lang/rust/issues/123733
%define cargo_test_skip --test-args "--skip panic_abort_doc_tests"
%global cargo_test_skip_list %{cargo_test_skip_list} panic_abort_doc_tests
%endif
%if %with disabled_libssh2
# These tests need ssh - guaranteed to fail when libssh2 is disabled.
%global cargo_test_skip_list %{shrink:
%{cargo_test_skip_list}
net_err_suggests_fetch_with_cli
ssh_something_happens
}
%endif
%if "%{cargo_test_skip_list}" != ""
%define cargo_test_skip --test-args "%(printf -- '--skip %%s ' %{cargo_test_skip_list})"
%endif
%{__x} test --no-fail-fast cargo %{?cargo_test_skip} || :
rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
@ -1030,7 +1097,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{__x} test --no-fail-fast rustfmt || :
%ldconfig_scriptlets
@ -1039,14 +1105,14 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%doc README.md
%{_bindir}/rustc
%{_bindir}/rustdoc
%{_libdir}/*.so
%{_libdir}/librustc_driver-*.so
%{_libexecdir}/rust-analyzer-proc-macro-srv
%{_mandir}/man1/rustc.1*
%{_mandir}/man1/rustdoc.1*
%dir %{rustlibdir}
%dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.so
%license build/manifests/rustc/cargo-vendor.txt
%license %{_pkgdocdir}/COPYRIGHT.html
%license %{_pkgdocdir}/licenses/
%exclude %{_sysconfdir}/target-spec-json-schema.json
%files std-static
@ -1054,13 +1120,17 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.rlib
%{rustlibdir}/%{rust_triple}/lib/*.so
%license build/manifests/std/cargo-vendor.txt
%license %{_pkgdocdir}/COPYRIGHT-library.html
%global target_files() \
%files std-static-%1 \
%dir %{rustlibdir} \
%dir %{rustlibdir}/%1 \
%dir %{rustlibdir}/%1/lib \
%{rustlibdir}/%1/lib/*.rlib
%{rustlibdir}/%1/lib/*.rlib \
%license build/manifests/std-%1/cargo-vendor.txt
%if %target_enabled i686-pc-windows-gnu
%target_files i686-pc-windows-gnu
@ -1080,15 +1150,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%target_files wasm32-unknown-unknown
%endif
%if %target_enabled wasm32-wasi
%target_files wasm32-wasi
%if %with bundled_wasi_libc
%dir %{rustlibdir}/wasm32-wasi/lib/self-contained
%{rustlibdir}/wasm32-wasi/lib/self-contained/crt*.o
%{rustlibdir}/wasm32-wasi/lib/self-contained/libc.a
%endif
%endif
%if %target_enabled wasm32-wasip1
%target_files wasm32-wasip1
%if %with bundled_wasi_libc
@ -1151,6 +1212,7 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{_datadir}/zsh/site-functions/_cargo
%dir %{_datadir}/cargo
%dir %{_datadir}/cargo/registry
%license build/manifests/cargo/cargo-vendor.txt
%files -n rustfmt
@ -1158,13 +1220,14 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{_bindir}/cargo-fmt
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md
%license src/tools/rustfmt/LICENSE-{APACHE,MIT}
%license build/manifests/rustfmt/cargo-vendor.txt
%files analyzer
%{_bindir}/rls
%{_bindir}/rust-analyzer
%doc src/tools/rust-analyzer/README.md
%license src/tools/rust-analyzer/LICENSE-{APACHE,MIT}
%license build/manifests/rust-analyzer/cargo-vendor.txt
%files -n clippy
@ -1172,6 +1235,7 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{_bindir}/clippy-driver
%doc src/tools/clippy/{README.md,CHANGELOG.md}
%license src/tools/clippy/LICENSE-{APACHE,MIT}
%license build/manifests/clippy/cargo-vendor.txt
%files src

View file

@ -1,44 +0,0 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-09-06 10:36:55.743405666 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-09-06 10:36:55.745405652 -0700
@@ -2156,7 +2156,6 @@ checksum = "10472326a8a6477c3c20a64547b0
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2197,20 +2196,6 @@ dependencies = [
"pkg-config",
"vcpkg",
]
-
-[[package]]
-name = "libssh2-sys"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
[[package]]
name = "libz-sys"
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 2024-09-06 10:36:55.746405645 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-09-06 10:37:13.849280464 -0700
@@ -44,7 +44,7 @@ curl = "0.4.46"
curl-sys = "0.4.73"
filetime = "0.2.23"
flate2 = { version = "1.0.30", default-features = false, features = ["zlib"] }
-git2 = "0.19.0"
+git2 = { version = "0.19.0", default-features = false, features = ["https"] }
git2-curl = "0.20.0"
gix = { version = "0.64.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "parallel", "dirwalk"] }
glob = "0.3.1"

View file

@ -1,23 +0,0 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-09-06 10:30:29.435107742 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-09-06 10:31:57.168492758 -0700
@@ -2194,7 +2194,6 @@ version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
dependencies = [
- "cc",
"pkg-config",
"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 2024-09-06 10:30:29.435107742 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-09-06 10:31:27.942697616 -0700
@@ -77,7 +77,7 @@ proptest = "1.5.0"
pulldown-cmark = { version = "0.11.0", default-features = false, features = ["html"] }
rand = "0.8.5"
regex = "1.10.5"
-rusqlite = { version = "0.32.0", features = ["bundled"] }
+rusqlite = { version = "0.32.0", features = [] }
rustfix = { version = "0.8.2", path = "crates/rustfix" }
same-file = "1.0.6"
security-framework = "2.11.1"

View file

@ -0,0 +1,44 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2025-08-16 15:47:14.000000000 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2025-08-18 17:31:39.554771554 -0700
@@ -2800,7 +2800,6 @@ checksum = "1c42fe03df2bd3c53a3a9c7317ad
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2847,20 +2846,6 @@ dependencies = [
"pkg-config",
"vcpkg",
]
-
-[[package]]
-name = "libssh2-sys"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "220e4f05ad4a218192533b300327f5150e809b54c4ec83b5a1d91833601811b9"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
[[package]]
name = "libz-rs-sys"
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-08-16 15:47:14.000000000 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2025-08-18 17:33:02.401743230 -0700
@@ -46,7 +46,7 @@ curl = "0.4.48"
curl-sys = "0.4.83"
filetime = "0.2.26"
flate2 = { version = "1.1.2", default-features = false, features = ["zlib-rs"] }
-git2 = "0.20.2"
+git2 = { version = "0.20.2", default-features = false, features = ["https"] }
git2-curl = "0.21.0"
# When updating this, also see if `gix-transport` further down needs updating or some auth-related tests will fail.
gix = { version = "0.73.0", default-features = false, features = ["progress-tree", "parallel", "dirwalk", "status"] }

View file

@ -0,0 +1,23 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2025-11-07 13:31:19.003737886 +0100
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2025-11-07 13:14:41.637982893 +0100
@@ -2835,7 +2835,6 @@ version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f"
dependencies = [
- "cc",
"pkg-config",
"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-11-07 13:31:28.338643618 +0100
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2025-11-07 13:15:00.266505214 +0100
@@ -81,7 +81,7 @@ proptest = "1.8.0"
pulldown-cmark = { version = "0.13.0", default-features = false, features = ["html"] }
rand = "0.9.2"
regex = "1.11.3"
-rusqlite = { version = "0.37.0", features = ["bundled"] }
+rusqlite = { version = "0.37.0", features = [] }
rustc-hash = "2.1.1"
rustc-stable-hash = "0.1.2"
rustfix = { version = "0.9.2", path = "crates/rustfix" }

View file

@ -1,2 +1,2 @@
SHA512 (rustc-1.82.0-src.tar.xz) = d158c7c71c1814bde2a3ec3cbeabe34949bd3201b730c0d7ec6baad4158bb28dd13696c430a6b99dc38b9d23ad7ddf8dde7d2487cbfbbbe9c3473016994210f0
SHA512 (wasi-libc-b9ef79d7dbd47c6c5bafdae760823467c2f60b70.tar.gz) = 089ee1f9faeccae85697823d415e34aac56df28cd9db99952a148cb9f91532edbae4ea78f8cd9a223903caadeeb17cbc31d55ea65b020692e4841ddf3914821e
SHA512 (rustc-1.92.0-src.tar.xz) = a2c0b127933595b9bc2063d7b7c88d9af512c4664b18f29d44c9a6e2c68d194b87a3071717e8f1b7c858ae940baca888e10be95cd31e0201916d0bfc312a3b15
SHA512 (wasi-libc-wasi-sdk-27.tar.gz) = dfc2c36fabf32f465fc833ed0b10efffc9a35c68162ecc3e8d656d1d684d170b734d55e790614d12d925d17f49d60f0d2d01c46cecac941cf62d68eda84df13e