From 50f1ca9cdb7f7a9bed0c04f2a4c00b0153a632c1 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Mon, 10 Mar 2025 14:11:37 +0000 Subject: [PATCH] import CS rust-1.84.1-1.el9 --- .gitignore | 4 +- .rust.metadata | 4 +- ...ble-jump-threading-of-float-equality.patch | 212 ------------- ...variables-override-some-default-CPUs.patch | 22 +- ...ssue-122805.rs-big-endian-compatible.patch | 49 --- ...ly-translate-profile-flags-for-Clang.patch | 39 +++ ...x86-64-cpu-in-tests-that-are-sensiti.patch | 264 ----------------- SOURCES/0001-Use-lld-provided-by-system.patch | 67 +++-- ...llow-disabling-target-self-contained.patch | 34 +-- ...xternal-library-path-for-wasm32-wasi.patch | 45 +-- SOURCES/macros.rust-toolset | 17 +- SOURCES/rustc-1.79.0-disable-libssh2.patch | 44 --- SOURCES/rustc-1.79.0-unbundle-sqlite.patch | 23 -- SOURCES/rustc-1.84.0-disable-libssh2.patch | 44 +++ SOURCES/rustc-1.84.0-unbundle-sqlite.patch | 23 ++ SPECS/rust.spec | 279 ++++++++++-------- 16 files changed, 366 insertions(+), 804 deletions(-) delete mode 100644 SOURCES/0001-Disable-jump-threading-of-float-equality.patch delete mode 100644 SOURCES/0001-Make-issue-122805.rs-big-endian-compatible.patch create mode 100644 SOURCES/0001-Only-translate-profile-flags-for-Clang.patch delete mode 100644 SOURCES/0001-Use-an-explicit-x86-64-cpu-in-tests-that-are-sensiti.patch delete mode 100644 SOURCES/rustc-1.79.0-disable-libssh2.patch delete mode 100644 SOURCES/rustc-1.79.0-unbundle-sqlite.patch create mode 100644 SOURCES/rustc-1.84.0-disable-libssh2.patch create mode 100644 SOURCES/rustc-1.84.0-unbundle-sqlite.patch diff --git a/.gitignore b/.gitignore index 389f046..fded82b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/rustc-1.79.0-src.tar.xz -SOURCES/wasi-libc-wasi-sdk-22.tar.gz +SOURCES/rustc-1.84.1-src.tar.xz +SOURCES/wasi-libc-wasi-sdk-25.tar.gz diff --git a/.rust.metadata b/.rust.metadata index 39b7583..9be28b5 100644 --- a/.rust.metadata +++ b/.rust.metadata @@ -1,2 +1,2 @@ -fdd94a3bdb321d18a0021d4dce9b8546a1db2eec SOURCES/rustc-1.79.0-src.tar.xz -13451249ddb71e69f12565ef4803b71ce4092191 SOURCES/wasi-libc-wasi-sdk-22.tar.gz +787899153e848b012d8bbd6ec0baf0ed5e189831 SOURCES/rustc-1.84.1-src.tar.xz +c42dc30854ecbce5380304c38bd48b5911d1ce62 SOURCES/wasi-libc-wasi-sdk-25.tar.gz diff --git a/SOURCES/0001-Disable-jump-threading-of-float-equality.patch b/SOURCES/0001-Disable-jump-threading-of-float-equality.patch deleted file mode 100644 index 29093bd..0000000 --- a/SOURCES/0001-Disable-jump-threading-of-float-equality.patch +++ /dev/null @@ -1,212 +0,0 @@ -From 49166c7dd925244f631277b4aa9ae4233f300884 Mon Sep 17 00:00:00 2001 -From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> -Date: Sat, 27 Jul 2024 15:08:11 +0200 -Subject: [PATCH] Disable jump threading of float equality - -Jump threading stores values as `u128` (`ScalarInt`) and does its -comparisons for equality as integer comparisons. -This works great for integers. Sadly, not everything is an integer. - -Floats famously have wonky equality semantcs, with `NaN!=NaN` and -`0.0 == -0.0`. This does not match our beautiful integer bitpattern -equality and therefore causes things to go horribly wrong. - -While jump threading could be extended to support floats by remembering -that they're floats in the value state and handling them properly, -it's signficantly easier to just disable it for now. - -(cherry picked from commit eca0a7e72346ba123ace318a0f9c28c57d990aeb) ---- - .../rustc_mir_transform/src/jump_threading.rs | 7 +++ - ...ding.floats.JumpThreading.panic-abort.diff | 59 +++++++++++++++++++ - ...ing.floats.JumpThreading.panic-unwind.diff | 59 +++++++++++++++++++ - tests/mir-opt/jump_threading.rs | 12 ++++ - 4 files changed, 137 insertions(+) - create mode 100644 tests/mir-opt/jump_threading.floats.JumpThreading.panic-abort.diff - create mode 100644 tests/mir-opt/jump_threading.floats.JumpThreading.panic-unwind.diff - -diff --git a/compiler/rustc_mir_transform/src/jump_threading.rs b/compiler/rustc_mir_transform/src/jump_threading.rs -index a458297210db..e2d2864ad2a0 100644 ---- a/compiler/rustc_mir_transform/src/jump_threading.rs -+++ b/compiler/rustc_mir_transform/src/jump_threading.rs -@@ -493,6 +493,13 @@ fn process_assign( - BinOp::Ne => ScalarInt::FALSE, - _ => return None, - }; -+ if value.const_.ty().is_floating_point() { -+ // Floating point equality does not follow bit-patterns. -+ // -0.0 and NaN both have special rules for equality, -+ // and therefore we cannot use integer comparisons for them. -+ // Avoid handling them, though this could be extended in the future. -+ return None; -+ } - let value = value.const_.normalize(self.tcx, self.param_env).try_to_scalar_int()?; - let conds = conditions.map(self.arena, |c| Condition { - value, -diff --git a/tests/mir-opt/jump_threading.floats.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.floats.JumpThreading.panic-abort.diff -new file mode 100644 -index 000000000000..6ca37e96d297 ---- /dev/null -+++ b/tests/mir-opt/jump_threading.floats.JumpThreading.panic-abort.diff -@@ -0,0 +1,59 @@ -+- // MIR for `floats` before JumpThreading -++ // MIR for `floats` after JumpThreading -+ -+ fn floats() -> u32 { -+ let mut _0: u32; -+ let _1: f64; -+ let mut _2: bool; -+ let mut _3: bool; -+ let mut _4: f64; -+ scope 1 { -+ debug x => _1; -+ } -+ -+ bb0: { -+ StorageLive(_1); -+ StorageLive(_2); -+ _2 = const true; -+- switchInt(move _2) -> [0: bb2, otherwise: bb1]; -++ goto -> bb1; -+ } -+ -+ bb1: { -+ _1 = const -0f64; -+ goto -> bb3; -+ } -+ -+ bb2: { -+ _1 = const 1f64; -+ goto -> bb3; -+ } -+ -+ bb3: { -+ StorageDead(_2); -+ StorageLive(_3); -+ StorageLive(_4); -+ _4 = _1; -+ _3 = Eq(move _4, const 0f64); -+ switchInt(move _3) -> [0: bb5, otherwise: bb4]; -+ } -+ -+ bb4: { -+ StorageDead(_4); -+ _0 = const 0_u32; -+ goto -> bb6; -+ } -+ -+ bb5: { -+ StorageDead(_4); -+ _0 = const 1_u32; -+ goto -> bb6; -+ } -+ -+ bb6: { -+ StorageDead(_3); -+ StorageDead(_1); -+ return; -+ } -+ } -+ -diff --git a/tests/mir-opt/jump_threading.floats.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.floats.JumpThreading.panic-unwind.diff -new file mode 100644 -index 000000000000..6ca37e96d297 ---- /dev/null -+++ b/tests/mir-opt/jump_threading.floats.JumpThreading.panic-unwind.diff -@@ -0,0 +1,59 @@ -+- // MIR for `floats` before JumpThreading -++ // MIR for `floats` after JumpThreading -+ -+ fn floats() -> u32 { -+ let mut _0: u32; -+ let _1: f64; -+ let mut _2: bool; -+ let mut _3: bool; -+ let mut _4: f64; -+ scope 1 { -+ debug x => _1; -+ } -+ -+ bb0: { -+ StorageLive(_1); -+ StorageLive(_2); -+ _2 = const true; -+- switchInt(move _2) -> [0: bb2, otherwise: bb1]; -++ goto -> bb1; -+ } -+ -+ bb1: { -+ _1 = const -0f64; -+ goto -> bb3; -+ } -+ -+ bb2: { -+ _1 = const 1f64; -+ goto -> bb3; -+ } -+ -+ bb3: { -+ StorageDead(_2); -+ StorageLive(_3); -+ StorageLive(_4); -+ _4 = _1; -+ _3 = Eq(move _4, const 0f64); -+ switchInt(move _3) -> [0: bb5, otherwise: bb4]; -+ } -+ -+ bb4: { -+ StorageDead(_4); -+ _0 = const 0_u32; -+ goto -> bb6; -+ } -+ -+ bb5: { -+ StorageDead(_4); -+ _0 = const 1_u32; -+ goto -> bb6; -+ } -+ -+ bb6: { -+ StorageDead(_3); -+ StorageDead(_1); -+ return; -+ } -+ } -+ -diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs -index 57f4e4a2654f..3e7e8995f1a3 100644 ---- a/tests/mir-opt/jump_threading.rs -+++ b/tests/mir-opt/jump_threading.rs -@@ -514,6 +514,16 @@ fn assume(a: u8, b: bool) -> u8 { - ) - } - -+fn floats() -> u32 { -+ // CHECK-LABEL: fn floats( -+ // CHECK: switchInt( -+ -+ // Test for issue #128243, where float equality was assumed to be bitwise. -+ // When adding float support, it must be ensured that this continues working properly. -+ let x = if true { -0.0 } else { 1.0 }; -+ if x == 0.0 { 0 } else { 1 } -+} -+ - fn main() { - // CHECK-LABEL: fn main( - too_complex(Ok(0)); -@@ -528,6 +538,7 @@ fn main() { - disappearing_bb(7); - aggregate(7); - assume(7, false); -+ floats(); - } - - // EMIT_MIR jump_threading.too_complex.JumpThreading.diff -@@ -542,3 +553,4 @@ fn main() { - // EMIT_MIR jump_threading.disappearing_bb.JumpThreading.diff - // EMIT_MIR jump_threading.aggregate.JumpThreading.diff - // EMIT_MIR jump_threading.assume.JumpThreading.diff -+// EMIT_MIR jump_threading.floats.JumpThreading.diff --- -2.46.0 - diff --git a/SOURCES/0001-Let-environment-variables-override-some-default-CPUs.patch b/SOURCES/0001-Let-environment-variables-override-some-default-CPUs.patch index dc8be55..302c7fd 100644 --- a/SOURCES/0001-Let-environment-variables-override-some-default-CPUs.patch +++ b/SOURCES/0001-Let-environment-variables-override-some-default-CPUs.patch @@ -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 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 23913687a1fd..3253fbc84c74 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 @@ - 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 a84a18a433ff..441af1018ff3 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 { +@@ -5,7 +5,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(16); + 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 59ec6c7f9d5f..b6f1be890b20 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 @@ - 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.47.1 diff --git a/SOURCES/0001-Make-issue-122805.rs-big-endian-compatible.patch b/SOURCES/0001-Make-issue-122805.rs-big-endian-compatible.patch deleted file mode 100644 index 23d9a86..0000000 --- a/SOURCES/0001-Make-issue-122805.rs-big-endian-compatible.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 26fa5c2c300f3c3a3ee3109c009bd4a6803a2a4c Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Tue, 11 Jun 2024 10:13:07 +0200 -Subject: [PATCH] Make issue-122805.rs big endian compatible - -Instead of not generating the function at all on big endian (which -makes the CHECK lines fail), instead use to_le() on big endian, -so that we essentially perform a bswap for both endiannesses. ---- - tests/codegen/issues/issue-122805.rs | 21 ++++++++++++--------- - 1 file changed, 12 insertions(+), 9 deletions(-) - -diff --git a/tests/codegen/issues/issue-122805.rs b/tests/codegen/issues/issue-122805.rs -index 6d108ada6dd..8e03c6c8884 100644 ---- a/tests/codegen/issues/issue-122805.rs -+++ b/tests/codegen/issues/issue-122805.rs -@@ -39,17 +39,20 @@ - // OPT3WINX64-NEXT: store <8 x i16> - // CHECK-NEXT: ret void - #[no_mangle] --#[cfg(target_endian = "little")] - pub fn convert(value: [u16; 8]) -> [u8; 16] { -+ #[cfg(target_endian = "little")] -+ let bswap = u16::to_be; -+ #[cfg(target_endian = "big")] -+ let bswap = u16::to_le; - let addr16 = [ -- value[0].to_be(), -- value[1].to_be(), -- value[2].to_be(), -- value[3].to_be(), -- value[4].to_be(), -- value[5].to_be(), -- value[6].to_be(), -- value[7].to_be(), -+ bswap(value[0]), -+ bswap(value[1]), -+ bswap(value[2]), -+ bswap(value[3]), -+ bswap(value[4]), -+ bswap(value[5]), -+ bswap(value[6]), -+ bswap(value[7]), - ]; - unsafe { core::mem::transmute::<_, [u8; 16]>(addr16) } - } --- -2.45.1 - diff --git a/SOURCES/0001-Only-translate-profile-flags-for-Clang.patch b/SOURCES/0001-Only-translate-profile-flags-for-Clang.patch new file mode 100644 index 0000000..3353c10 --- /dev/null +++ b/SOURCES/0001-Only-translate-profile-flags-for-Clang.patch @@ -0,0 +1,39 @@ +From e4e678eb9cbd90acf2ba51e9ec0209b05c4403b5 Mon Sep 17 00:00:00 2001 +From: Josh Stone +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 + diff --git a/SOURCES/0001-Use-an-explicit-x86-64-cpu-in-tests-that-are-sensiti.patch b/SOURCES/0001-Use-an-explicit-x86-64-cpu-in-tests-that-are-sensiti.patch deleted file mode 100644 index c427d51..0000000 --- a/SOURCES/0001-Use-an-explicit-x86-64-cpu-in-tests-that-are-sensiti.patch +++ /dev/null @@ -1,264 +0,0 @@ -From 706f06c39a9e08a4708a53722429d13ae4069c2f Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Wed, 1 May 2024 15:25:26 -0700 -Subject: [PATCH] Use an explicit x86-64 cpu in tests that are sensitive to it - -There are a few tests that depend on some target features **not** being -enabled by default, and usually they are correct with the default x86-64 -target CPU. However, in downstream builds we have modified the default -to fit our distros -- `x86-64-v2` in RHEL 9 and `x86-64-v3` in RHEL 10 --- and the latter especially trips tests that expect not to have AVX. - -These cases are few enough that we can just set them back explicitly. ---- - tests/assembly/simd-intrinsic-mask-reduce.rs | 1 + - tests/assembly/x86_64-floating-point-clamp.rs | 2 +- - .../codegen/target-feature-inline-closure.rs | 2 +- - tests/ui/asm/x86_64/target-feature-attr.rs | 1 + - .../ui/asm/x86_64/target-feature-attr.stderr | 8 +++--- - .../const-eval/const_fn_target_feature.rs | 2 +- - .../rfc-2396-target_feature-11/safe-calls.rs | 1 + - .../safe-calls.stderr | 28 +++++++++---------- - tests/ui/sse2.rs | 4 +-- - 9 files changed, 26 insertions(+), 23 deletions(-) - -diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs -index 763401755fad..0d77fc410511 100644 ---- a/tests/assembly/simd-intrinsic-mask-reduce.rs -+++ b/tests/assembly/simd-intrinsic-mask-reduce.rs -@@ -1,6 +1,7 @@ - // verify that simd mask reductions do not introduce additional bit shift operations - //@ revisions: x86 aarch64 - //@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel -+//@ [x86] compile-flags: -C target-cpu=x86-64 - //@ [x86] needs-llvm-components: x86 - //@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu - //@ [aarch64] needs-llvm-components: aarch64 -diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly/x86_64-floating-point-clamp.rs -index 4a72a7f44fa0..b963aee35590 100644 ---- a/tests/assembly/x86_64-floating-point-clamp.rs -+++ b/tests/assembly/x86_64-floating-point-clamp.rs -@@ -2,7 +2,7 @@ - // so check to make sure that's what it's actually emitting. - - //@ assembly-output: emit-asm --//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -+//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64 - //@ only-x86_64 - //@ ignore-sgx - -diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen/target-feature-inline-closure.rs -index 88bd413a8707..20bb4e66ff21 100644 ---- a/tests/codegen/target-feature-inline-closure.rs -+++ b/tests/codegen/target-feature-inline-closure.rs -@@ -1,5 +1,5 @@ - //@ only-x86_64 --//@ compile-flags: -Copt-level=3 -+//@ compile-flags: -Copt-level=3 -Ctarget-cpu=x86-64 - - #![crate_type = "lib"] - #![feature(target_feature_11)] -diff --git a/tests/ui/asm/x86_64/target-feature-attr.rs b/tests/ui/asm/x86_64/target-feature-attr.rs -index 820be132ef79..51829be15065 100644 ---- a/tests/ui/asm/x86_64/target-feature-attr.rs -+++ b/tests/ui/asm/x86_64/target-feature-attr.rs -@@ -1,4 +1,5 @@ - //@ only-x86_64 -+//@ compile-flags: -C target-cpu=x86-64 - - #![feature(avx512_target_feature)] - -diff --git a/tests/ui/asm/x86_64/target-feature-attr.stderr b/tests/ui/asm/x86_64/target-feature-attr.stderr -index c852726ee7ff..1a9962732cfb 100644 ---- a/tests/ui/asm/x86_64/target-feature-attr.stderr -+++ b/tests/ui/asm/x86_64/target-feature-attr.stderr -@@ -1,23 +1,23 @@ - error: register class `ymm_reg` requires the `avx` target feature -- --> $DIR/target-feature-attr.rs:18:40 -+ --> $DIR/target-feature-attr.rs:19:40 - | - LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x); - | ^^^^^^^^^^^^^ - - error: register class `ymm_reg` requires the `avx` target feature -- --> $DIR/target-feature-attr.rs:18:55 -+ --> $DIR/target-feature-attr.rs:19:55 - | - LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x); - | ^^^^^^^^^^^^^ - - error: register class `ymm_reg` requires the `avx` target feature -- --> $DIR/target-feature-attr.rs:18:70 -+ --> $DIR/target-feature-attr.rs:19:70 - | - LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x); - | ^^^^^^^^^^^^^^^^^^ - - error: register class `kreg` requires at least one of the following target features: avx512bw, avx512f -- --> $DIR/target-feature-attr.rs:33:23 -+ --> $DIR/target-feature-attr.rs:34:23 - | - LL | asm!("/* {0} */", in(kreg) x); - | ^^^^^^^^^^ -diff --git a/tests/ui/consts/const-eval/const_fn_target_feature.rs b/tests/ui/consts/const-eval/const_fn_target_feature.rs -index b56b68a57958..d0de9d8d7a34 100644 ---- a/tests/ui/consts/const-eval/const_fn_target_feature.rs -+++ b/tests/ui/consts/const-eval/const_fn_target_feature.rs -@@ -1,5 +1,5 @@ - //@ only-x86_64 --//@ compile-flags:-C target-feature=+ssse3 -+//@ compile-flags: -C target-cpu=x86-64 -C target-feature=+ssse3 - - #![crate_type = "lib"] - -diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs -index c73b8d7e4d29..6fb0688008e6 100644 ---- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs -+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs -@@ -1,4 +1,5 @@ - //@ only-x86_64 -+//@ compile-flags: -C target-cpu=x86-64 - - #![feature(target_feature_11)] - -diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr -index d9d7e297f8e9..fed3da6594cb 100644 ---- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr -+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr -@@ -1,5 +1,5 @@ - error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:25:5 -+ --> $DIR/safe-calls.rs:26:5 - | - LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` -@@ -8,7 +8,7 @@ LL | sse2(); - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - - error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:27:5 -+ --> $DIR/safe-calls.rs:28:5 - | - LL | avx_bmi2(); - | ^^^^^^^^^^ call to function with `#[target_feature]` -@@ -16,7 +16,7 @@ LL | avx_bmi2(); - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - - error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:29:5 -+ --> $DIR/safe-calls.rs:30:5 - | - LL | Quux.avx_bmi2(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` -@@ -24,7 +24,7 @@ LL | Quux.avx_bmi2(); - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - - error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:35:5 -+ --> $DIR/safe-calls.rs:36:5 - | - LL | avx_bmi2(); - | ^^^^^^^^^^ call to function with `#[target_feature]` -@@ -32,7 +32,7 @@ LL | avx_bmi2(); - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - - error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:37:5 -+ --> $DIR/safe-calls.rs:38:5 - | - LL | Quux.avx_bmi2(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` -@@ -40,7 +40,7 @@ LL | Quux.avx_bmi2(); - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - - error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:43:5 -+ --> $DIR/safe-calls.rs:44:5 - | - LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` -@@ -49,7 +49,7 @@ LL | sse2(); - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - - error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:45:5 -+ --> $DIR/safe-calls.rs:46:5 - | - LL | avx_bmi2(); - | ^^^^^^^^^^ call to function with `#[target_feature]` -@@ -57,7 +57,7 @@ LL | avx_bmi2(); - = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 - - error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:47:5 -+ --> $DIR/safe-calls.rs:48:5 - | - LL | Quux.avx_bmi2(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` -@@ -65,7 +65,7 @@ LL | Quux.avx_bmi2(); - = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 - - error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:54:5 -+ --> $DIR/safe-calls.rs:55:5 - | - LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` -@@ -74,7 +74,7 @@ LL | sse2(); - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - - error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:58:15 -+ --> $DIR/safe-calls.rs:59:15 - | - LL | const _: () = sse2(); - | ^^^^^^ call to function with `#[target_feature]` -@@ -83,7 +83,7 @@ LL | const _: () = sse2(); - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - - error[E0133]: call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe and requires unsafe function or block -- --> $DIR/safe-calls.rs:61:15 -+ --> $DIR/safe-calls.rs:62:15 - | - LL | const _: () = sse2_and_fxsr(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` -@@ -92,7 +92,7 @@ LL | const _: () = sse2_and_fxsr(); - = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]` - - error: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block (error E0133) -- --> $DIR/safe-calls.rs:68:5 -+ --> $DIR/safe-calls.rs:69:5 - | - LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` -@@ -101,12 +101,12 @@ LL | sse2(); - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - note: an unsafe function restricts its caller, but its body is safe by default -- --> $DIR/safe-calls.rs:67:1 -+ --> $DIR/safe-calls.rs:68:1 - | - LL | unsafe fn needs_unsafe_block() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - note: the lint level is defined here -- --> $DIR/safe-calls.rs:64:8 -+ --> $DIR/safe-calls.rs:65:8 - | - LL | #[deny(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ -diff --git a/tests/ui/sse2.rs b/tests/ui/sse2.rs -index fa6d79713b4b..c203ca2716ff 100644 ---- a/tests/ui/sse2.rs -+++ b/tests/ui/sse2.rs -@@ -20,6 +20,6 @@ fn main() { - "SSE2 was not detected as available on an x86 platform"); - } - // check a negative case too -- allowed on x86, but not enabled by default -- assert!(cfg!(not(target_feature = "avx2")), -- "AVX2 shouldn't be detected as available by default on any platform"); -+ assert!(cfg!(not(target_feature = "avx512f")), -+ "AVX512 shouldn't be detected as available by default on any platform"); - } --- -2.44.0 - diff --git a/SOURCES/0001-Use-lld-provided-by-system.patch b/SOURCES/0001-Use-lld-provided-by-system.patch index 8fcf4dc..063d66a 100644 --- a/SOURCES/0001-Use-lld-provided-by-system.patch +++ b/SOURCES/0001-Use-lld-provided-by-system.patch @@ -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 -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 --- - compiler/rustc_target/src/spec/base/wasm.rs | 3 +-- - compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs | 2 +- - compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs | 1 + - 3 files changed, 3 insertions(+), 3 deletions(-) + 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_uefi.rs | 1 + + 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 87ade9e58cf4..2ddff95febab 100644 +index f237391016e7..08bcd9699b4a 100644 --- a/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 limit_rdylib_exports: false, @@ -23,8 +25,33 @@ index 87ade9e58cf4..2ddff95febab 100644 linker_flavor: LinkerFlavor::WasmLld(Cc::No), 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 -index 9aa95a35f8e5..a9172f9441b7 100644 +index 549706998d46..b7e9158ddef5 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 { @@ -33,11 +60,11 @@ index 9aa95a35f8e5..a9172f9441b7 100644 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), - linker: Some("rust-lld".into()), + linker: Some("lld".into()), - features: - "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float" - .into(), + 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 5abfb8162f70..13cb43bda1a4 100644 +index 6da1fcca58c8..c84ae44576d4 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 { @@ -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 // 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 diff --git a/SOURCES/0001-bootstrap-allow-disabling-target-self-contained.patch b/SOURCES/0001-bootstrap-allow-disabling-target-self-contained.patch index a168218..34d735d 100644 --- a/SOURCES/0001-bootstrap-allow-disabling-target-self-contained.patch +++ b/SOURCES/0001-bootstrap-allow-disabling-target-self-contained.patch @@ -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 Date: Thu, 28 Sep 2023 18:14:28 -0700 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(+) diff --git a/config.example.toml b/config.example.toml -index f94553dd63f7..5ec969c80a37 100644 +index d3233ad17b51..6a1f097c20cb 100644 --- a/config.example.toml +++ b/config.example.toml -@@ -869,6 +869,11 @@ +@@ -916,6 +916,11 @@ # argument as the test binary. #runner = (string) @@ -27,10 +27,10 @@ index f94553dd63f7..5ec969c80a37 100644 # Distribution options # 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 +++ 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, target: TargetSelection, ) -> Vec<(PathBuf, DependencyType)> { @@ -38,14 +38,14 @@ index e927b491c71e..69a80d01d6b9 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 3e1bc9a9acdd..5e24a9cc4f60 100644 +index e706aba977b6..a55d98e94dd8 100644 --- a/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, pub no_std: bool, pub codegen_backends: Option>, @@ -53,9 +53,9 @@ index 3e1bc9a9acdd..5e24a9cc4f60 100644 } impl Target { -@@ -594,6 +595,9 @@ pub fn from_triple(triple: &str) -> Self { - if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") { - target.no_std = true; +@@ -638,6 +639,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,7 +63,7 @@ index 3e1bc9a9acdd..5e24a9cc4f60 100644 target } } -@@ -1150,6 +1154,7 @@ struct TomlTarget { +@@ -1213,6 +1217,7 @@ struct TomlTarget { no_std: Option = "no-std", codegen_backends: Option> = "codegen-backends", runner: Option = "runner", @@ -71,7 +71,7 @@ index 3e1bc9a9acdd..5e24a9cc4f60 100644 } } -@@ -1870,6 +1875,9 @@ fn get_table(option: &str) -> Result { +@@ -2038,6 +2043,9 @@ fn get_table(option: &str) -> Result { if let Some(s) = cfg.no_std { target.no_std = s; } @@ -82,10 +82,10 @@ index 3e1bc9a9acdd..5e24a9cc4f60 100644 target.cxx = cfg.cxx.map(PathBuf::from); target.ar = cfg.ar.map(PathBuf::from); diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs -index 5ed6b357e20a..c23b21d65713 100644 +index c384fd6bf435..a101c010b740 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs -@@ -1348,6 +1348,11 @@ fn no_std(&self, target: TargetSelection) -> Option { +@@ -1351,6 +1351,11 @@ fn no_std(&self, target: TargetSelection) -> Option { self.config.target_config.get(&target).map(|t| t.no_std) } @@ -98,5 +98,5 @@ index 5ed6b357e20a..c23b21d65713 100644 /// and `remote-test-server` binaries. fn remote_tested(&self, target: TargetSelection) -> bool { -- -2.44.0 +2.47.1 diff --git a/SOURCES/0002-set-an-external-library-path-for-wasm32-wasi.patch b/SOURCES/0002-set-an-external-library-path-for-wasm32-wasi.patch index 34ab22a..3a05424 100644 --- a/SOURCES/0002-set-an-external-library-path-for-wasm32-wasi.patch +++ b/SOURCES/0002-set-an-external-library-path-for-wasm32-wasi.patch @@ -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 Date: Thu, 28 Sep 2023 18:18:16 -0700 Subject: [PATCH 2/2] set an external library path for wasm32-wasi --- - compiler/rustc_codegen_ssa/src/back/link.rs | 9 +++++++++ - compiler/rustc_target/src/spec/mod.rs | 4 ++++ - compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++--- - 3 files changed, 17 insertions(+), 3 deletions(-) + compiler/rustc_codegen_ssa/src/back/link.rs | 10 ++++++++++ + compiler/rustc_target/src/spec/mod.rs | 4 ++++ + .../rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++--- + 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 -index f5e8d5fc92a9..f4ad3f725427 100644 +index 5149e3a12f23..cf62fbdc7f59 100644 --- a/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; } } @@ -23,13 +23,14 @@ index f5e8d5fc92a9..f4ad3f725427 100644 + 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); if file_path.exists() { -@@ -2049,6 +2055,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained: - let lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path(); - cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); - } +@@ -2163,6 +2169,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,10 +38,10 @@ index f5e8d5fc92a9..f4ad3f725427 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 941d767b850d..cd0a2ce51989 100644 +index 321ab40403a3..54791c8892d8 100644 --- a/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. pub pre_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. pub pre_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, pre_link_objects: Default::default(), post_link_objects: Default::default(), @@ -56,7 +57,7 @@ index 941d767b850d..cd0a2ce51989 100644 pre_link_objects_self_contained: Default::default(), post_link_objects_self_contained: Default::default(), 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!(pre_link_objects = "pre-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!(post_link_objects_self_contained = "post-link-objects-fallback", link_objects); // 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!(pre_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!(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 -index 7cbe9f09e6ca..b524890c2ec5 100644 +index 1cd30f21bec1..9a752d5712a6 100644 --- a/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 { - options.os = "wasi".into(); - options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasi"]); +@@ -19,11 +19,12 @@ pub(crate) fn target() -> Target { + options.env = "p1".into(); + 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(); @@ -93,5 +94,5 @@ index 7cbe9f09e6ca..b524890c2ec5 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.44.0 +2.47.1 diff --git a/SOURCES/macros.rust-toolset b/SOURCES/macros.rust-toolset index 152d257..6a2f7f5 100644 --- a/SOURCES/macros.rust-toolset +++ b/SOURCES/macros.rust-toolset @@ -162,16 +162,13 @@ EOF}\ # of a specific binary has been installed, but which conflicts between builds # of different Rust applications and is not needed when building RPM packages. %cargo_install\ -(\ -set -euo pipefail \ - %{shrink: \ - %{__cargo} install \ - %{__cargo_common_opts} \ - --profile rpm \ - --no-track \ - --path . \ - } \ -) +%{shrink: \ + %{__cargo} install \ + %{__cargo_common_opts} \ + --profile rpm \ + --no-track \ + --path . \ +} # cargo_license: print license information for all crate dependencies # diff --git a/SOURCES/rustc-1.79.0-disable-libssh2.patch b/SOURCES/rustc-1.79.0-disable-libssh2.patch deleted file mode 100644 index 6b3c90c..0000000 --- a/SOURCES/rustc-1.79.0-disable-libssh2.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff -up rustc-1.79.0-src/src/tools/cargo/Cargo.lock.orig rustc-1.79.0-src/src/tools/cargo/Cargo.lock ---- rustc-1.79.0-src/src/tools/cargo/Cargo.lock.orig 2024-06-13 16:37:16.640599290 -0700 -+++ rustc-1.79.0-src/src/tools/cargo/Cargo.lock 2024-06-13 16:37:16.646599231 -0700 -@@ -2150,7 +2150,6 @@ checksum = "ee4126d8b4ee5c9d9ea891dd875c - dependencies = [ - "cc", - "libc", -- "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -@@ -2191,20 +2190,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-1.79.0-src/src/tools/cargo/Cargo.toml.orig rustc-1.79.0-src/src/tools/cargo/Cargo.toml ---- rustc-1.79.0-src/src/tools/cargo/Cargo.toml.orig 2024-06-13 16:37:16.646599231 -0700 -+++ rustc-1.79.0-src/src/tools/cargo/Cargo.toml 2024-06-13 16:39:06.040526596 -0700 -@@ -44,7 +44,7 @@ curl = "0.4.46" - curl-sys = "0.4.72" - filetime = "0.2.23" - flate2 = { version = "1.0.28", default-features = false, features = ["zlib"] } --git2 = "0.18.3" -+git2 = { version = "0.18.3", default-features = false, features = ["https"] } - git2-curl = "0.19.0" - gix = { version = "0.63.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision", "parallel", "dirwalk"] } - glob = "0.3.1" diff --git a/SOURCES/rustc-1.79.0-unbundle-sqlite.patch b/SOURCES/rustc-1.79.0-unbundle-sqlite.patch deleted file mode 100644 index 8101227..0000000 --- a/SOURCES/rustc-1.79.0-unbundle-sqlite.patch +++ /dev/null @@ -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 2006-07-24 10:21:28.000000000 +0900 -+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-05-06 14:13:00.172595245 +0900 -@@ -2191,7 +2191,6 @@ version = "0.28.0" - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" - 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-05-06 14:13:00.173595257 +0900 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-05-06 14:13:54.089275003 +0900 -@@ -77,7 +77,7 @@ proptest = "1.4.0" - pulldown-cmark = { version = "0.10.2", default-features = false, features = ["html"] } - rand = "0.8.5" - regex = "1.10.4" --rusqlite = { version = "0.31.0", features = ["bundled"] } -+rusqlite = { version = "0.31.0", features = [] } - rustfix = { version = "0.8.2", path = "crates/rustfix" } - same-file = "1.0.6" - security-framework = "2.10.0" diff --git a/SOURCES/rustc-1.84.0-disable-libssh2.patch b/SOURCES/rustc-1.84.0-disable-libssh2.patch new file mode 100644 index 0000000..267bc3c --- /dev/null +++ b/SOURCES/rustc-1.84.0-disable-libssh2.patch @@ -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" diff --git a/SOURCES/rustc-1.84.0-unbundle-sqlite.patch b/SOURCES/rustc-1.84.0-unbundle-sqlite.patch new file mode 100644 index 0000000..2e3ecc3 --- /dev/null +++ b/SOURCES/rustc-1.84.0-unbundle-sqlite.patch @@ -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" diff --git a/SPECS/rust.spec b/SPECS/rust.spec index 6bd1a47..91fc381 100644 --- a/SPECS/rust.spec +++ b/SPECS/rust.spec @@ -1,6 +1,6 @@ Name: rust -Version: 1.79.0 -Release: 2%{?dist} +Version: 1.84.1 +Release: 1%{?dist} 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) # ^ 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 # e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13 # or nightly wants some beta-YYYY-MM-DD -%global bootstrap_version 1.78.0 -%global bootstrap_channel 1.78.0 -%global bootstrap_date 2024-05-02 +%global bootstrap_version 1.83.0 +%global bootstrap_channel 1.83.0 +%global bootstrap_date 2024-11-28 # Only the specified arches will use bootstrap binaries. # 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! #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 # 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-22 +%global wasi_libc_ref wasi-sdk-25 %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} @@ -66,27 +42,36 @@ 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 18.1.7 +# is insufficient. Rust currently requires LLVM 18.0+. +%global min_llvm_version 18.0.0 +%global bundled_llvm_version 19.1.5 #global llvm_compat_version 17 %global llvm llvm%{?llvm_compat_version} %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. -%global min_libgit2_version 1.7.2 -%global next_libgit2_version 1.8.0~ -%global bundled_libgit2_version 1.7.2 -%if 0%{?fedora} >= 39 +%global min_libgit2_version 1.8.1 +%global next_libgit2_version 1.9.0~ +%global bundled_libgit2_version 1.8.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.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 %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 %bcond_without bundled_sqlite3 %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 # 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 -Patch7: 0001-Use-an-explicit-x86-64-cpu-in-tests-that-are-sensiti.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 +# https://github.com/rust-lang/cc-rs/issues/1354 +Patch7: 0001-Only-translate-profile-flags-for-Clang.patch ### RHEL-specific patches below ### @@ -171,16 +150,14 @@ Source101: cargo_vendor.attr Source102: cargo_vendor.prov # 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. -%{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 @@ -189,11 +166,42 @@ Patch100: rustc-1.79.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(string.find(rpm.expand(" %{all_targets} "), rpm.expand(" %1 "), 1, true) or 0) } %if %defined bootstrap_arches @@ -227,7 +235,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 @@ -247,6 +255,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 @@ -294,7 +306,10 @@ BuildRequires: python3-rpm 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} @@ -424,18 +439,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 @@ -445,6 +448,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 @@ -454,6 +459,12 @@ Requires: lld %target_description x86_64-unknown-none embedded %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 %target_package x86_64-unknown-uefi Requires: lld @@ -557,6 +568,9 @@ A tool for formatting Rust code according to style guidelines. %package analyzer 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. Recommends: %{name}-src @@ -642,9 +656,7 @@ rm -rf %{wasi_libc_dir}/dlmalloc/ %if %without bundled_sqlite3 %patch -P6 -p1 %endif -%patch -P7 -p1 -%patch -P8 -p1 -%patch -P9 -p1 +%patch -P7 -p1 -d vendor/cc-1.2.5 %if %with disabled_libssh2 %patch -P100 -p1 @@ -661,6 +673,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 # Remove other unused vendored libraries. This leaves the directory in place, # 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/ %endif +%if %without bundled_oniguruma +%clear_dir vendor/onig_sys*/oniguruma/ +%endif + %if %without bundled_sqlite3 %clear_dir vendor/libsqlite3-sys*/sqlite3/ %endif @@ -731,6 +751,7 @@ 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} } @@ -740,12 +761,23 @@ end} %{export_rust_env} # Some builders have relatively little memory for their CPU count. -# At least 2GB 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) / 2 )) -if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then - ncpus="$max_cpus" -fi +# At least 4GB per CPU is a good rule of thumb for building rustc. +%if ! %defined 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: @@ -765,16 +797,12 @@ 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 } @@ -786,12 +814,7 @@ fi # 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 test -r "%{profiler}" @@ -814,14 +837,18 @@ test -r "%{profiler}" %{!?llvm_has_filecheck: --disable-codegen-tests} \ %{!?with_llvm_static: --enable-llvm-link-shared } } \ --disable-llvm-static-stdcpp \ + --disable-llvm-bitcode-linker \ + --disable-lld \ --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 \ --enable-extended \ --tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \ --enable-vendor \ @@ -836,7 +863,7 @@ test -r "%{profiler}" %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 env LLVM_PROFILE_FILE="%{profraw}/default_%%m_%%p.profraw" \ %{__x} --keep-stage=0 --keep-stage=1 build cargo @@ -848,7 +875,7 @@ rm -r "%{profraw}" build/%{rust_triple}/stage2*/ %endif # Build the compiler normally (with or without PGO) -%{__x} build -j "$ncpus" sysroot +%{__x} build sysroot # Build everything else normally %{__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 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' \ @@ -890,18 +917,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 '{}' '+' @@ -974,9 +995,12 @@ rm -rf "$TMP_HELLO" # 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. -# Bootstrap is excluded because it's not something we ship, and a lot of its -# tests are geared toward the upstream CI environment. -%{__x} test --no-fail-fast --skip src/bootstrap || : +# - Bootstrap is excluded because it's not something we ship, and a lot of its +# tests are geared toward the upstream CI environment. +# - 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/" %ifarch aarch64 @@ -1001,14 +1025,10 @@ 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 %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}/lib %{rustlibdir}/%{rust_triple}/lib/*.rlib +%{rustlibdir}/%{rust_triple}/lib/*.so %global target_files() \ %files std-static-%1 \ @@ -1042,15 +1063,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 @@ -1064,6 +1076,10 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %target_files x86_64-unknown-none %endif +%if %target_enabled aarch64-unknown-uefi +%target_files aarch64-unknown-uefi +%endif + %if %target_enabled x86_64-unknown-uefi %target_files x86_64-unknown-uefi %endif @@ -1146,6 +1162,25 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %changelog +* Tue Feb 04 2025 Josh Stone - 1.84.1-1 +- Update to 1.84.1 + +* Wed Jan 15 2025 Josh Stone - 1.84.0-1 +- Update to 1.84.0 + +* Thu Dec 05 2024 Josh Stone - 1.83.0-1 +- Update to 1.83.0 +- Remove the subshell in the cargo_install macro + +* Tue Nov 05 2024 Josh Stone - 1.82.0-1 +- Update to 1.82.0 + +* Fri Oct 25 2024 Josh Stone - 1.81.0-1 +- Update to 1.81.0 + +* Tue Oct 22 2024 Josh Stone - 1.80.1-1 +- Update to 1.80.1 + * Tue Aug 13 2024 Josh Stone - 1.79.0-2 - Disable jump threading of float equality