update to 1.84

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 2025-08-26 08:31:33 +02:00
parent a64614c632
commit a274322fd5
8 changed files with 353 additions and 199 deletions

View File

@ -1,4 +1,4 @@
From 184d61d2c12aa2db01de9a14ccb2be0cfae5039b Mon Sep 17 00:00:00 2001 From 5273432acfae75d6e509bbebcf8d28b0f3d820d0 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com> From: Josh Stone <jistone@redhat.com>
Date: Fri, 9 Jun 2023 15:23:08 -0700 Date: Fri, 9 Jun 2023 15:23:08 -0700
Subject: [PATCH] Let environment variables override some default CPUs 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(-) 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 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 23913687a1fd..3253fbc84c74 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs --- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
+++ b/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 @@ @@ -2,7 +2,7 @@
pub fn target() -> Target { pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts(); let mut base = base::linux_gnu::opts();
- base.cpu = "ppc64le".into(); - base.cpu = "ppc64le".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_PPC64LE").unwrap_or("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.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::Inline; 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 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 a84a18a433ff..441af1018ff3 100644
--- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs --- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
+++ b/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 { @@ -5,7 +5,7 @@ pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts(); let mut base = base::linux_gnu::opts();
base.endian = Endian::Big; base.endian = Endian::Big;
// z10 is the oldest CPU supported by LLVM // z10 is the oldest CPU supported by LLVM
- base.cpu = "z10".into(); - base.cpu = "z10".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_S390X").unwrap_or("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 base.max_atomic_width = Some(128);
// ABI. Pass the -vector feature string to LLVM to respect this assumption. On LLVM < 16, we base.min_global_align = Some(16);
// also strip v128 from the data_layout below to match the older LLVM's expectation. 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 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 59ec6c7f9d5f..b6f1be890b20 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs --- 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 +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
pub fn target() -> Target { pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts(); let mut base = base::linux_gnu::opts();
- base.cpu = "x86-64".into(); - base.cpu = "x86-64".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_X86_64").unwrap_or("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.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
-- --
2.41.0 2.47.1



View File

@ -0,0 +1,39 @@
From e4e678eb9cbd90acf2ba51e9ec0209b05c4403b5 Mon Sep 17 00:00:00 2001
From: Josh Stone <cuviper@gmail.com>
Date: Thu, 9 Jan 2025 16:47:10 -0800
Subject: [PATCH] Only translate profile flags for Clang

---
src/flags.rs | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/flags.rs b/src/flags.rs
index 81834cf625f7..1a53c1b2345c 100644
--- a/src/flags.rs
+++ b/src/flags.rs
@@ -201,13 +201,15 @@ impl<'this> RustcCodegenFlags<'this> {
if self.no_vectorize_slp {
push_if_supported("-fno-slp-vectorize".into());
}
- // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-generate
- if let Some(value) = self.profile_generate {
- push_if_supported(format!("-fprofile-generate={value}").into());
- }
- // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-use
- if let Some(value) = self.profile_use {
- push_if_supported(format!("-fprofile-use={value}").into());
+ if let ToolFamily::Clang { .. } = family {
+ // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-generate
+ if let Some(value) = self.profile_generate {
+ push_if_supported(format!("-fprofile-generate={value}").into());
+ }
+ // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-use
+ if let Some(value) = self.profile_use {
+ push_if_supported(format!("-fprofile-use={value}").into());
+ }
}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mguard
if let Some(value) = self.control_flow_guard {
--
2.47.1

View File

@ -1,19 +1,21 @@
From 61b5cc96337da2121221dd1bcdb63fd36551d065 Mon Sep 17 00:00:00 2001 From 3d8c6d095581e8d7585f3772cfd16f6367f3c008 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com> From: Josh Stone <jistone@redhat.com>
Date: Wed, 1 Nov 2023 15:21:15 -0700 Date: Fri, 16 Aug 2024 10:12:58 -0700
Subject: [PATCH] Use lld provided by system Subject: [PATCH] Use lld provided by system


--- ---
compiler/rustc_target/src/spec/base/wasm.rs | 3 +-- compiler/rustc_target/src/spec/base/wasm.rs | 3 +--
.../src/spec/targets/aarch64_unknown_none_softfloat.rs | 2 +-
compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs | 1 +
compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs | 2 +- compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs | 2 +-
compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs | 1 + compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs | 1 +
3 files changed, 3 insertions(+), 3 deletions(-) 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 diff --git a/compiler/rustc_target/src/spec/base/wasm.rs b/compiler/rustc_target/src/spec/base/wasm.rs
index 87ade9e58cf4..2ddff95febab 100644 index f237391016e7..08bcd9699b4a 100644
--- a/compiler/rustc_target/src/spec/base/wasm.rs --- a/compiler/rustc_target/src/spec/base/wasm.rs
+++ b/compiler/rustc_target/src/spec/base/wasm.rs +++ b/compiler/rustc_target/src/spec/base/wasm.rs
@@ -91,8 +91,7 @@ macro_rules! args { @@ -85,8 +85,7 @@ macro_rules! args {
// arguments just yet // arguments just yet
limit_rdylib_exports: false, limit_rdylib_exports: false,
@ -23,8 +25,33 @@ index 87ade9e58cf4..2ddff95febab 100644
linker_flavor: LinkerFlavor::WasmLld(Cc::No), linker_flavor: LinkerFlavor::WasmLld(Cc::No),
pre_link_args, 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
--- 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 {
let opts = TargetOptions {
abi: "softfloat".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
- linker: Some("rust-lld".into()),
+ linker: Some("lld".into()),
features: "+v8a,+strict-align,-neon,-fp-armv8".into(),
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
--- 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 {
base.max_atomic_width = Some(128);
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/machine:arm64"]);
base.features = "+v8a".into();
+ base.linker = Some("lld".into());
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 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 9aa95a35f8e5..a9172f9441b7 100644 index 549706998d46..b7e9158ddef5 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
+++ b/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 { @@ -17,7 +17,7 @@ pub fn target() -> Target {
@ -33,11 +60,11 @@ index 9aa95a35f8e5..a9172f9441b7 100644
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
- linker: Some("rust-lld".into()), - linker: Some("rust-lld".into()),
+ linker: Some("lld".into()), + linker: Some("lld".into()),
features: features: "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float".into(),
"-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float" supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
.into(), 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 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 5abfb8162f70..13cb43bda1a4 100644 index 6da1fcca58c8..c84ae44576d4 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
+++ b/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 { @@ -16,6 +16,7 @@ pub fn target() -> Target {
@ -48,18 +75,6 @@ index 5abfb8162f70..13cb43bda1a4 100644
// We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to // 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 // enable these CPU features explicitly before their first use, otherwise their instructions
diff -Naur a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs 2024-03-17 12:03:00.000000000 -0700
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs 2024-03-22 10:02:17.742806274 -0700
@@ -14,7 +14,7 @@
let opts = TargetOptions {
abi: "softfloat".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
- linker: Some("rust-lld".into()),
+ linker: Some("lld".into()),
features: "+v8a,+strict-align,-neon,-fp-armv8".into(),
relocation_model: RelocModel::Static,
disable_redzone: true,
-- --
2.41.0 2.46.0



View File

@ -1,4 +1,4 @@
From 2b99134e2884fa56bcab6d360885ec5421048e66 Mon Sep 17 00:00:00 2001 From 8d4d52446347872816ab51958e9f3162cf722ee6 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com> From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:14:28 -0700 Date: Thu, 28 Sep 2023 18:14:28 -0700
Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
@ -11,10 +11,10 @@ Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
4 files changed, 22 insertions(+) 4 files changed, 22 insertions(+)


diff --git a/config.example.toml b/config.example.toml diff --git a/config.example.toml b/config.example.toml
index f94553dd63f7..5ec969c80a37 100644 index d3233ad17b51..6a1f097c20cb 100644
--- a/config.example.toml --- a/config.example.toml
+++ b/config.example.toml +++ b/config.example.toml
@@ -869,6 +869,11 @@ @@ -916,6 +916,11 @@
# argument as the test binary. # argument as the test binary.
#runner = <none> (string) #runner = <none> (string)
@ -27,10 +27,10 @@ index f94553dd63f7..5ec969c80a37 100644
# Distribution options # Distribution options
# #
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index e927b491c71e..69a80d01d6b9 100644 index 8e088682f92d..843b7123b120 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs --- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -356,6 +356,10 @@ fn copy_self_contained_objects( @@ -346,6 +346,10 @@ fn copy_self_contained_objects(
compiler: &Compiler, compiler: &Compiler,
target: TargetSelection, target: TargetSelection,
) -> Vec<(PathBuf, DependencyType)> { ) -> Vec<(PathBuf, DependencyType)> {
@ -38,14 +38,14 @@ index e927b491c71e..69a80d01d6b9 100644
+ return vec![]; + 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)); 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 diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 3e1bc9a9acdd..5e24a9cc4f60 100644 index e706aba977b6..a55d98e94dd8 100644
--- a/src/bootstrap/src/core/config/config.rs --- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs
@@ -586,6 +586,7 @@ pub struct Target { @@ -627,6 +627,7 @@ pub struct Target {
pub runner: Option<String>, pub runner: Option<String>,
pub no_std: bool, pub no_std: bool,
pub codegen_backends: Option<Vec<String>>, pub codegen_backends: Option<Vec<String>>,
@ -53,9 +53,9 @@ index 3e1bc9a9acdd..5e24a9cc4f60 100644
} }
impl Target { impl Target {
@@ -594,6 +595,9 @@ pub fn from_triple(triple: &str) -> Self { @@ -638,6 +639,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") { if triple.contains("emscripten") {
target.no_std = true; target.runner = Some("node".into());
} }
+ if triple.contains("-musl") || triple.contains("-wasi") || triple.contains("-windows-gnu") { + if triple.contains("-musl") || triple.contains("-wasi") || triple.contains("-windows-gnu") {
+ target.self_contained = true; + target.self_contained = true;
@ -63,7 +63,7 @@ index 3e1bc9a9acdd..5e24a9cc4f60 100644
target target
} }
} }
@@ -1150,6 +1154,7 @@ struct TomlTarget { @@ -1213,6 +1217,7 @@ struct TomlTarget {
no_std: Option<bool> = "no-std", no_std: Option<bool> = "no-std",
codegen_backends: Option<Vec<String>> = "codegen-backends", codegen_backends: Option<Vec<String>> = "codegen-backends",
runner: Option<String> = "runner", runner: Option<String> = "runner",
@ -71,7 +71,7 @@ index 3e1bc9a9acdd..5e24a9cc4f60 100644
} }
} }
@@ -1870,6 +1875,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> { @@ -2038,6 +2043,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
if let Some(s) = cfg.no_std { if let Some(s) = cfg.no_std {
target.no_std = s; target.no_std = s;
} }
@ -82,10 +82,10 @@ index 3e1bc9a9acdd..5e24a9cc4f60 100644
target.cxx = cfg.cxx.map(PathBuf::from); target.cxx = cfg.cxx.map(PathBuf::from);
target.ar = cfg.ar.map(PathBuf::from); target.ar = cfg.ar.map(PathBuf::from);
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 5ed6b357e20a..c23b21d65713 100644 index c384fd6bf435..a101c010b740 100644
--- a/src/bootstrap/src/lib.rs --- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs
@@ -1348,6 +1348,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> { @@ -1351,6 +1351,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
self.config.target_config.get(&target).map(|t| t.no_std) self.config.target_config.get(&target).map(|t| t.no_std)
} }
@ -98,5 +98,5 @@ index 5ed6b357e20a..c23b21d65713 100644
/// and `remote-test-server` binaries. /// and `remote-test-server` binaries.
fn remote_tested(&self, target: TargetSelection) -> bool { fn remote_tested(&self, target: TargetSelection) -> bool {
-- --
2.44.0 2.47.1



View File

@ -1,19 +1,19 @@
From e3b7d2e3d3b4fcbc6591de606957c0fd59b5e547 Mon Sep 17 00:00:00 2001 From 21d53eca2af5f04c0aa6b898f99f58e0e093cfdd Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com> From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:18:16 -0700 Date: Thu, 28 Sep 2023 18:18:16 -0700
Subject: [PATCH 2/2] set an external library path for wasm32-wasi Subject: [PATCH 2/2] set an external library path for wasm32-wasi


--- ---
compiler/rustc_codegen_ssa/src/back/link.rs | 9 +++++++++ compiler/rustc_codegen_ssa/src/back/link.rs | 10 ++++++++++
compiler/rustc_target/src/spec/mod.rs | 4 ++++ compiler/rustc_target/src/spec/mod.rs | 4 ++++
compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++--- .../rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++---
3 files changed, 17 insertions(+), 3 deletions(-) 3 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 diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index f5e8d5fc92a9..f4ad3f725427 100644 index 5149e3a12f23..cf62fbdc7f59 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs --- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1563,6 +1563,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat @@ -1663,6 +1663,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
return file_path; return file_path;
} }
} }
@ -23,13 +23,14 @@ index f5e8d5fc92a9..f4ad3f725427 100644
+ return file_path; + return file_path;
+ } + }
+ } + }
for search_path in fs.search_paths() { for search_path in sess.target_filesearch().search_paths(PathKind::Native) {
let file_path = search_path.dir.join(name); let file_path = search_path.dir.join(name);
if file_path.exists() { if file_path.exists() {
@@ -2049,6 +2055,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained: @@ -2163,6 +2169,10 @@ fn add_library_search_dirs(
let lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path(); ControlFlow::<()>::Continue(())
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); },
} );
+
+ if let Some(lib_path) = &sess.target.options.external_lib_path { + if let Some(lib_path) = &sess.target.options.external_lib_path {
+ cmd.include_path(Path::new(lib_path.as_ref())); + cmd.include_path(Path::new(lib_path.as_ref()));
+ } + }
@ -37,10 +38,10 @@ index f5e8d5fc92a9..f4ad3f725427 100644
/// Add options making relocation sections in the produced ELF files read-only /// 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 diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 941d767b850d..cd0a2ce51989 100644 index 321ab40403a3..54791c8892d8 100644
--- a/compiler/rustc_target/src/spec/mod.rs --- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1881,6 +1881,7 @@ pub struct TargetOptions { @@ -2155,6 +2155,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code. /// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects, pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects, pub post_link_objects: CrtObjects,
@ -48,7 +49,7 @@ index 941d767b850d..cd0a2ce51989 100644
/// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled. /// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled.
pub pre_link_objects_self_contained: CrtObjects, pub pre_link_objects_self_contained: CrtObjects,
pub post_link_objects_self_contained: CrtObjects, pub post_link_objects_self_contained: CrtObjects,
@@ -2368,6 +2369,7 @@ fn default() -> TargetOptions { @@ -2651,6 +2652,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None, relro_level: RelroLevel::None,
pre_link_objects: Default::default(), pre_link_objects: Default::default(),
post_link_objects: Default::default(), post_link_objects: Default::default(),
@ -56,7 +57,7 @@ index 941d767b850d..cd0a2ce51989 100644
pre_link_objects_self_contained: Default::default(), pre_link_objects_self_contained: Default::default(),
post_link_objects_self_contained: Default::default(), post_link_objects_self_contained: Default::default(),
link_self_contained: LinkSelfContainedDefault::False, link_self_contained: LinkSelfContainedDefault::False,
@@ -3064,6 +3066,7 @@ macro_rules! key { @@ -3355,6 +3357,7 @@ macro_rules! key {
key!(linker_is_gnu_json = "linker-is-gnu", bool); key!(linker_is_gnu_json = "linker-is-gnu", bool);
key!(pre_link_objects = "pre-link-objects", link_objects); key!(pre_link_objects = "pre-link-objects", link_objects);
key!(post_link_objects = "post-link-objects", link_objects); key!(post_link_objects = "post-link-objects", link_objects);
@ -64,7 +65,7 @@ index 941d767b850d..cd0a2ce51989 100644
key!(pre_link_objects_self_contained = "pre-link-objects-fallback", link_objects); key!(pre_link_objects_self_contained = "pre-link-objects-fallback", link_objects);
key!(post_link_objects_self_contained = "post-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` // Deserializes the backwards-compatible variants of `-Clink-self-contained`
@@ -3327,6 +3330,7 @@ macro_rules! target_option_val { @@ -3636,6 +3639,7 @@ macro_rules! target_option_val {
target_option_val!(linker_is_gnu_json, "linker-is-gnu"); target_option_val!(linker_is_gnu_json, "linker-is-gnu");
target_option_val!(pre_link_objects); target_option_val!(pre_link_objects);
target_option_val!(post_link_objects); target_option_val!(post_link_objects);
@ -73,12 +74,12 @@ index 941d767b850d..cd0a2ce51989 100644
target_option_val!(post_link_objects_self_contained, "post-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"); target_option_val!(link_args - pre_link_args_json, "pre-link-args");
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
index 7cbe9f09e6ca..b524890c2ec5 100644 index 1cd30f21bec1..9a752d5712a6 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs --- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs +++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
@@ -20,11 +20,12 @@ pub fn target() -> Target { @@ -19,11 +19,12 @@ pub(crate) fn target() -> Target {
options.os = "wasi".into(); 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.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
- options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained(); - options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
@ -93,5 +94,5 @@ index 7cbe9f09e6ca..b524890c2ec5 100644
// Right now this is a bit of a workaround but we're currently saying that // 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 // the target by default has a static crt which we're taking as a signal
-- --
2.44.0 2.47.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 2024-12-12 14:07:10.755481543 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-12-12 14:07:10.756481534 -0800
@@ -2272,7 +2272,6 @@ checksum = "10472326a8a6477c3c20a64547b0
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2313,20 +2312,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-12-12 14:07:10.756481534 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-12-12 14:07:56.866087428 -0800
@@ -47,7 +47,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.67.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "parallel", "dirwalk"] }
glob = "0.3.1"

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 2024-12-07 06:47:38.000000000 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-12-12 14:02:54.412672539 -0800
@@ -2310,7 +2310,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-12-12 14:02:54.412672539 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-12-12 14:03:25.665405417 -0800
@@ -80,7 +80,7 @@ proptest = "1.5.0"
pulldown-cmark = { version = "0.12.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 = [] }
rustc-hash = "2.0.0"
rustfix = { version = "0.9.0", path = "crates/rustfix" }
same-file = "1.0.6"

View File

@ -1,6 +1,6 @@
Name: rust Name: rust
Version: 1.79.0 Version: 1.84.1
Release: 3%{?dist} Release: 1%{?dist}
Summary: The Rust Programming Language 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-DFS-2016)
# ^ written as: (rust itself) and (bundled libraries) # ^ written as: (rust itself) and (bundled libraries)
@ -14,9 +14,9 @@ ExclusiveArch: %{rust_arches}
# To bootstrap from scratch, set the channel and date from src/stage0.json # 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 # e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13
# or nightly wants some beta-YYYY-MM-DD # or nightly wants some beta-YYYY-MM-DD
%global bootstrap_version 1.78.0 %global bootstrap_version 1.83.0
%global bootstrap_channel 1.78.0 %global bootstrap_channel 1.83.0
%global bootstrap_date 2024-05-02 %global bootstrap_date 2024-11-28


# Only the specified arches will use bootstrap binaries. # Only the specified arches will use bootstrap binaries.
# NOTE: Those binaries used to be uploaded with every new release, but that was # NOTE: Those binaries used to be uploaded with every new release, but that was
@ -25,34 +25,10 @@ ExclusiveArch: %{rust_arches}
# add them to sources. Remember to remove them again after the bootstrap build! # add them to sources. Remember to remove them again after the bootstrap build!
#global bootstrap_arches %%{rust_arches} #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} || 0%{?rhel} >= 10
%global extra_targets x86_64-unknown-none x86_64-unknown-uefi
%endif
%endif
%ifarch aarch64
%if 0%{?fedora} || 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 # 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 # 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_url https://github.com/WebAssembly/wasi-libc
%global wasi_libc_ref wasi-sdk-22 %global wasi_libc_ref wasi-sdk-25
%global wasi_libc_name wasi-libc-%{wasi_libc_ref} %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_source %{wasi_libc_url}/archive/%{wasi_libc_ref}/%{wasi_libc_name}.tar.gz
%global wasi_libc_dir %{_builddir}/%{wasi_libc_name} %global wasi_libc_dir %{_builddir}/%{wasi_libc_name}
@ -66,27 +42,36 @@ ExclusiveArch: %{rust_arches}
%bcond_with llvm_static %bcond_with llvm_static


# We can also choose to just use Rust's bundled LLVM, in case the system LLVM # We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 17.0+. # is insufficient. Rust currently requires LLVM 18.0+.
%global min_llvm_version 17.0.0 %global min_llvm_version 18.0.0
%global bundled_llvm_version 18.1.7 %global bundled_llvm_version 19.1.5
#global llvm_compat_version 17 #global llvm_compat_version 17
%global llvm llvm%{?llvm_compat_version} %global llvm llvm%{?llvm_compat_version}
%bcond_with bundled_llvm %bcond_with bundled_llvm


# Requires stable libgit2 1.7, and not the next minor soname change. # Requires stable libgit2 1.8, and not the next minor soname change.
# This needs to be consistent with the bindings in vendor/libgit2-sys. # This needs to be consistent with the bindings in vendor/libgit2-sys.
%global min_libgit2_version 1.7.2 %global min_libgit2_version 1.8.1
%global next_libgit2_version 1.8.0~ %global next_libgit2_version 1.9.0~
%global bundled_libgit2_version 1.7.2 %global bundled_libgit2_version 1.8.1
%if 0%{?fedora} >= 39 %if 0%{?fedora} >= 41
%bcond_with bundled_libgit2 %bcond_with bundled_libgit2
%else %else
%bcond_without bundled_libgit2 %bcond_without bundled_libgit2
%endif %endif


# Try to use system oniguruma (only used at build time for rust-docs)
# src/tools/rustbook -> ... -> onig_sys v69.8.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 # Cargo uses UPSERTs with omitted conflict targets
%global min_sqlite3_version 3.35 %global min_sqlite3_version 3.35
%global bundled_sqlite3_version 3.45.0 %global bundled_sqlite3_version 3.46.0
%if 0%{?rhel} && 0%{?rhel} < 10 %if 0%{?rhel} && 0%{?rhel} < 10
%bcond_without bundled_sqlite3 %bcond_without bundled_sqlite3
%else %else
@ -152,16 +137,10 @@ Patch4: 0001-bootstrap-allow-disabling-target-self-contained.patch
Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch


# We don't want to use the bundled library in libsqlite3-sys # We don't want to use the bundled library in libsqlite3-sys
Patch6: rustc-1.79.0-unbundle-sqlite.patch Patch6: rustc-1.84.0-unbundle-sqlite.patch


# https://github.com/rust-lang/rust/pull/124597 # https://github.com/rust-lang/cc-rs/issues/1354
Patch7: 0001-Use-an-explicit-x86-64-cpu-in-tests-that-are-sensiti.patch Patch7: 0001-Only-translate-profile-flags-for-Clang.patch

# Fix codegen test failure on big endian: https://github.com/rust-lang/rust/pull/126263
Patch8: 0001-Make-issue-122805.rs-big-endian-compatible.patch

# https://github.com/rust-lang/rust/pull/128271
Patch9: 0001-Disable-jump-threading-of-float-equality.patch


### RHEL-specific patches below ### ### RHEL-specific patches below ###


@ -171,16 +150,14 @@ Source101: cargo_vendor.attr
Source102: cargo_vendor.prov Source102: cargo_vendor.prov


# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
Patch100: rustc-1.79.0-disable-libssh2.patch Patch100: rustc-1.84.0-disable-libssh2.patch


# Get the Rust triple for any arch. # Get the Rust triple for any architecture and ABI.
%{lua: function rust_triple(arch) %{lua: function rust_triple(arch, abi)
local abi = "gnu" abi = abi or "gnu"
if arch == "armv7hl" then if arch == "armv7hl" then
arch = "armv7" arch = "armv7"
abi = "gnueabihf" abi = abi.."eabihf"
elseif arch == "ppc64" then
arch = "powerpc64"
elseif arch == "ppc64le" then elseif arch == "ppc64le" then
arch = "powerpc64le" arch = "powerpc64le"
elseif arch == "riscv64" then elseif arch == "riscv64" then
@ -189,11 +166,42 @@ Patch100: rustc-1.79.0-disable-libssh2.patch
return arch.."-unknown-linux-"..abi return arch.."-unknown-linux-"..abi
end} 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 # Get the environment variable form of the Rust triple.
%global rust_triple_env %{lua: %define rust_triple_env() %{lua:
print(string.upper(string.gsub(rpm.expand("%{rust_triple}"), "-", "_"))) 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(string.find(rpm.expand(" %{all_targets} "), rpm.expand(" %1 "), 1, true) or 0)
} }


%if %defined bootstrap_arches %if %defined bootstrap_arches
@ -227,7 +235,7 @@ end}
%global local_rust_root %{_builddir}/rust-%{bootstrap_suffix} %global local_rust_root %{_builddir}/rust-%{bootstrap_suffix}
Provides: bundled(%{name}-bootstrap) = %{bootstrap_version} Provides: bundled(%{name}-bootstrap) = %{bootstrap_version}
%else %else
BuildRequires: cargo >= %{bootstrap_version} BuildRequires: (cargo >= %{bootstrap_version} with cargo <= %{version})
BuildRequires: (%{name} >= %{bootstrap_version} with %{name} <= %{version}) BuildRequires: (%{name} >= %{bootstrap_version} with %{name} <= %{version})
%global local_rust_root %{_prefix} %global local_rust_root %{_prefix}
%endif %endif
@ -247,6 +255,10 @@ BuildRequires: pkgconfig(zlib)
BuildRequires: (pkgconfig(libgit2) >= %{min_libgit2_version} with pkgconfig(libgit2) < %{next_libgit2_version}) BuildRequires: (pkgconfig(libgit2) >= %{min_libgit2_version} with pkgconfig(libgit2) < %{next_libgit2_version})
%endif %endif


%if %{without bundled_oniguruma}
BuildRequires: pkgconfig(oniguruma) >= %{min_oniguruma_version}
%endif

%if %{without bundled_sqlite3} %if %{without bundled_sqlite3}
BuildRequires: pkgconfig(sqlite3) >= %{min_sqlite3_version} BuildRequires: pkgconfig(sqlite3) >= %{min_sqlite3_version}
%endif %endif
@ -294,7 +306,10 @@ BuildRequires: python3-rpm
BuildRequires: glibc-static BuildRequires: glibc-static


# For tests/run-make/pgo-branch-weights # For tests/run-make/pgo-branch-weights
# riscv64 does not support binutils-gold yet
%ifnarch riscv64
BuildRequires: binutils-gold BuildRequires: binutils-gold
%endif


# Virtual provides for folks who attempt "dnf install rustc" # Virtual provides for folks who attempt "dnf install rustc"
Provides: rustc = %{version}-%{release} Provides: rustc = %{version}-%{release}
@ -424,18 +439,6 @@ BuildArch: noarch
%target_description wasm32-unknown-unknown WebAssembly %target_description wasm32-unknown-unknown WebAssembly
%endif %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 %if %target_enabled wasm32-wasip1
%target_package wasm32-wasip1 %target_package wasm32-wasip1
Requires: lld >= 8.0 Requires: lld >= 8.0
@ -445,6 +448,8 @@ Provides: bundled(wasi-libc)
Requires: wasi-libc-static Requires: wasi-libc-static
%endif %endif
BuildArch: noarch 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 %target_description wasm32-wasip1 WebAssembly
%endif %endif


@ -454,6 +459,12 @@ Requires: lld
%target_description x86_64-unknown-none embedded %target_description x86_64-unknown-none embedded
%endif %endif


%if %target_enabled aarch64-unknown-uefi
%target_package aarch64-unknown-uefi
Requires: lld
%target_description aarch64-unknown-uefi embedded
%endif

%if %target_enabled x86_64-unknown-uefi %if %target_enabled x86_64-unknown-uefi
%target_package x86_64-unknown-uefi %target_package x86_64-unknown-uefi
Requires: lld Requires: lld
@ -557,6 +568,9 @@ A tool for formatting Rust code according to style guidelines.
%package analyzer %package analyzer
Summary: Rust implementation of the Language Server Protocol Summary: Rust implementation of the Language Server Protocol


# /usr/bin/rust-analyzer is dynamically linked against internal rustc libs
Requires: %{name}%{?_isa} = %{version}-%{release}

# The standard library sources are needed for most functionality. # The standard library sources are needed for most functionality.
Recommends: %{name}-src Recommends: %{name}-src


@ -642,9 +656,7 @@ rm -rf %{wasi_libc_dir}/dlmalloc/
%if %without bundled_sqlite3 %if %without bundled_sqlite3
%patch -P6 -p1 %patch -P6 -p1
%endif %endif
%patch -P7 -p1 %patch -P7 -p1 -d vendor/cc-1.2.5
%patch -P8 -p1
%patch -P9 -p1


%if %with disabled_libssh2 %if %with disabled_libssh2
%patch -P100 -p1 %patch -P100 -p1
@ -661,6 +673,10 @@ rm -rf src/llvm-project/
mkdir -p src/llvm-project/libunwind/ mkdir -p src/llvm-project/libunwind/
%endif %endif


# Remove submodules we don't need.
rm -rf src/gcc
rm -rf src/tools/enzyme
rm -rf src/tools/rustc-perf


# Remove other unused vendored libraries. This leaves the directory in place, # Remove other unused vendored libraries. This leaves the directory in place,
# because some build scripts watch them, e.g. "cargo:rerun-if-changed=curl". # because some build scripts watch them, e.g. "cargo:rerun-if-changed=curl".
@ -679,6 +695,10 @@ mkdir -p src/llvm-project/libunwind/
%clear_dir vendor/libgit2-sys*/libgit2/ %clear_dir vendor/libgit2-sys*/libgit2/
%endif %endif


%if %without bundled_oniguruma
%clear_dir vendor/onig_sys*/oniguruma/
%endif

%if %without bundled_sqlite3 %if %without bundled_sqlite3
%clear_dir vendor/libsqlite3-sys*/sqlite3/ %clear_dir vendor/libsqlite3-sys*/sqlite3/
%endif %endif
@ -731,6 +751,7 @@ end}
%global rust_env %{shrink: %global rust_env %{shrink:
%{?rustflags:RUSTFLAGS="%{rustflags}"} %{?rustflags:RUSTFLAGS="%{rustflags}"}
%{rustc_target_cpus} %{rustc_target_cpus}
%{!?with_bundled_oniguruma:RUSTONIG_SYSTEM_LIBONIG=1}
%{!?with_bundled_sqlite3:LIBSQLITE3_SYS_USE_PKG_CONFIG=1} %{!?with_bundled_sqlite3:LIBSQLITE3_SYS_USE_PKG_CONFIG=1}
%{!?with_disabled_libssh2:LIBSSH2_SYS_USE_PKG_CONFIG=1} %{!?with_disabled_libssh2:LIBSSH2_SYS_USE_PKG_CONFIG=1}
} }
@ -740,12 +761,23 @@ end}
%{export_rust_env} %{export_rust_env}


# Some builders have relatively little memory for their CPU count. # Some builders have relatively little memory for their CPU count.
# At least 2GB per CPU is a good rule of thumb for building rustc. # At least 4GB per CPU is a good rule of thumb for building rustc.
ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN) %if ! %defined constrain_build
max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 2 )) %define constrain_build(m:) %{lua:
if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then for l in io.lines('/proc/meminfo') do
ncpus="$max_cpus" if l:sub(1, 9) == "MemTotal:" then
fi 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 %if %defined mingw_targets
%define mingw_target_config %{shrink: %define mingw_target_config %{shrink:
@ -765,16 +797,12 @@ fi
%if %defined wasm_targets %if %defined wasm_targets
%if %with bundled_wasi_libc %if %with bundled_wasi_libc
%define wasi_libc_flags MALLOC_IMPL=emmalloc CC=clang AR=llvm-ar NM=llvm-nm %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 %make_build --quiet -C %{wasi_libc_dir} %{wasi_libc_flags} TARGET_TRIPLE=wasm32-wasip1
%define wasm_target_config %{shrink: %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 --set target.wasm32-wasip1.wasi-root=%{wasi_libc_dir}/sysroot
} }
%else %else
%define wasm_target_config %{shrink: %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.wasi-root=%{_prefix}/wasm32-wasi
--set target.wasm32-wasip1.self-contained=false --set target.wasm32-wasip1.self-contained=false
} }
@ -786,12 +814,7 @@ fi
# clang_resource_dir is not defined for compat builds. # 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 %define profiler /usr/lib/clang/%{llvm_compat_version}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a
%else %else
%if 0%{?clang_major_version} >= 17
%define profiler %{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a %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 %endif
test -r "%{profiler}" test -r "%{profiler}"


@ -814,14 +837,18 @@ test -r "%{profiler}"
%{!?llvm_has_filecheck: --disable-codegen-tests} \ %{!?llvm_has_filecheck: --disable-codegen-tests} \
%{!?with_llvm_static: --enable-llvm-link-shared } } \ %{!?with_llvm_static: --enable-llvm-link-shared } } \
--disable-llvm-static-stdcpp \ --disable-llvm-static-stdcpp \
--disable-llvm-bitcode-linker \
--disable-lld \
--disable-rpath \ --disable-rpath \
%{enable_debuginfo} \ %{enable_debuginfo} \
%{enable_rust_opts} \ %{enable_rust_opts} \
--set build.jobs=%_smp_build_ncpus \
--set build.build-stage=2 \ --set build.build-stage=2 \
--set build.doc-stage=2 \ --set build.doc-stage=2 \
--set build.install-stage=2 \ --set build.install-stage=2 \
--set build.test-stage=2 \ --set build.test-stage=2 \
--set build.optimized-compiler-builtins=false \ --set build.optimized-compiler-builtins=false \
--set rust.llvm-tools=false \
--enable-extended \ --enable-extended \
--tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \ --tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \
--enable-vendor \ --enable-vendor \
@ -836,7 +863,7 @@ test -r "%{profiler}"
%define profraw $PWD/build/profiles %define profraw $PWD/build/profiles
%define profdata $PWD/build/rustc.profdata %define profdata $PWD/build/rustc.profdata
mkdir -p "%{profraw}" 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 # Build cargo as a workload to generate compiler profiles
env LLVM_PROFILE_FILE="%{profraw}/default_%%m_%%p.profraw" \ env LLVM_PROFILE_FILE="%{profraw}/default_%%m_%%p.profraw" \
%{__x} --keep-stage=0 --keep-stage=1 build cargo %{__x} --keep-stage=0 --keep-stage=1 build cargo
@ -848,7 +875,7 @@ rm -r "%{profraw}" build/%{rust_triple}/stage2*/
%endif %endif


# Build the compiler normally (with or without PGO) # Build the compiler normally (with or without PGO)
%{__x} build -j "$ncpus" sysroot %{__x} build sysroot


# Build everything else normally # Build everything else normally
%{__x} build %{__x} build
@ -879,7 +906,7 @@ rm -rf ./build/dist/ ./build/tmp/
# Some of the components duplicate-install binaries, leaving backups we don't want # Some of the components duplicate-install binaries, leaving backups we don't want
rm -f %{buildroot}%{_bindir}/*.old 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}" %if "%{_libdir}" != "%{common_libdir}"
mkdir -p %{buildroot}%{_libdir} mkdir -p %{buildroot}%{_libdir}
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \ find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
@ -890,18 +917,12 @@ find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \ find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
-exec chmod -v +x '{}' '+' -exec chmod -v +x '{}' '+'


# The libdir libraries are identical to those under rustlib/. It's easier on # The shared standard library is excluded from Provides, because it has no
# library loading if we keep them in libdir, but we do need them in rustlib/ # stable ABI. However, we still ship it alongside the static target libraries
# to support dynamic linking for compiler plugins, so we'll symlink. # to enable some niche local use-cases, like the `evcxr` REPL.
find %{buildroot}%{rustlibdir}/%{rust_triple}/lib/ -maxdepth 1 -type f -name '*.so' | # Make sure those libraries are also executable for debuginfo extraction.
while read lib; do find %{buildroot}%{rustlibdir} -type f -name '*.so' \
lib2="%{buildroot}%{_libdir}/${lib##*/}" -exec chmod -v +x '{}' '+'
if [ -f "$lib2" ]; then
# make sure they're actually identical!
cmp "$lib" "$lib2"
ln -v -f -r -s -T "$lib2" "$lib"
fi
done


# Remove installer artifacts (manifests, uninstall scripts, etc.) # Remove installer artifacts (manifests, uninstall scripts, etc.)
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+' find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
@ -974,9 +995,12 @@ rm -rf "$TMP_HELLO"
# The results are not stable on koji, so mask errors and just log it. # The results are not stable on koji, so mask errors and just log it.
# Some of the larger test artifacts are manually cleaned to save space. # Some of the larger test artifacts are manually cleaned to save space.


# Bootstrap is excluded because it's not something we ship, and a lot of its # - Bootstrap is excluded because it's not something we ship, and a lot of its
# tests are geared toward the upstream CI environment. # tests are geared toward the upstream CI environment.
%{__x} test --no-fail-fast --skip src/bootstrap || : # - Crashes are excluded because they are less reliable, especially stuff like
# SIGSEGV across different arches -- UB can do all kinds of weird things.
# They're only meant to notice "accidental" fixes anyway, not *should* crash.
%{__x} test --no-fail-fast --skip={src/bootstrap,tests/crashes} || :
rm -rf "./build/%{rust_triple}/test/" rm -rf "./build/%{rust_triple}/test/"


%ifarch aarch64 %ifarch aarch64
@ -1001,14 +1025,10 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%doc README.md %doc README.md
%{_bindir}/rustc %{_bindir}/rustc
%{_bindir}/rustdoc %{_bindir}/rustdoc
%{_libdir}/*.so %{_libdir}/librustc_driver-*.so
%{_libexecdir}/rust-analyzer-proc-macro-srv %{_libexecdir}/rust-analyzer-proc-macro-srv
%{_mandir}/man1/rustc.1* %{_mandir}/man1/rustc.1*
%{_mandir}/man1/rustdoc.1* %{_mandir}/man1/rustdoc.1*
%dir %{rustlibdir}
%dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.so




%files std-static %files std-static
@ -1016,6 +1036,7 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%dir %{rustlibdir}/%{rust_triple} %dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib %dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.rlib %{rustlibdir}/%{rust_triple}/lib/*.rlib
%{rustlibdir}/%{rust_triple}/lib/*.so


%global target_files() \ %global target_files() \
%files std-static-%1 \ %files std-static-%1 \
@ -1042,15 +1063,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%target_files wasm32-unknown-unknown %target_files wasm32-unknown-unknown
%endif %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 %if %target_enabled wasm32-wasip1
%target_files wasm32-wasip1 %target_files wasm32-wasip1
%if %with bundled_wasi_libc %if %with bundled_wasi_libc
@ -1064,6 +1076,10 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%target_files x86_64-unknown-none %target_files x86_64-unknown-none
%endif %endif


%if %target_enabled aarch64-unknown-uefi
%target_files aarch64-unknown-uefi
%endif

%if %target_enabled x86_64-unknown-uefi %if %target_enabled x86_64-unknown-uefi
%target_files x86_64-unknown-uefi %target_files x86_64-unknown-uefi
%endif %endif
@ -1146,9 +1162,25 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"




%changelog %changelog
* Fri Dec 06 2024 Josh Stone <jistone@redhat.com> - 1.79.0-3 * Tue Feb 04 2025 Josh Stone <jistone@redhat.com> - 1.84.1-1
- Update to 1.84.1

* Wed Jan 15 2025 Josh Stone <jistone@redhat.com> - 1.84.0-1
- Update to 1.84.0

* Thu Dec 05 2024 Josh Stone <jistone@redhat.com> - 1.83.0-1
- Update to 1.83.0
- Remove the subshell in the cargo_install macro - Remove the subshell in the cargo_install macro


* Tue Nov 05 2024 Josh Stone <jistone@redhat.com> - 1.82.0-1
- Update to 1.82.0

* Fri Oct 25 2024 Josh Stone <jistone@redhat.com> - 1.81.0-1
- Update to 1.81.0

* Tue Oct 22 2024 Josh Stone <jistone@redhat.com> - 1.80.1-1
- Update to 1.80.1

* Tue Aug 13 2024 Josh Stone <jistone@redhat.com> - 1.79.0-2 * Tue Aug 13 2024 Josh Stone <jistone@redhat.com> - 1.79.0-2
- Disable jump threading of float equality - Disable jump threading of float equality