diff --git a/0001-Fix-UI-tests-with-dist-vendored-dependencies.patch b/0001-Fix-UI-tests-with-dist-vendored-dependencies.patch deleted file mode 100644 index 2d18d3088baae7e944a451eb0c37e59ae7c4982f..0000000000000000000000000000000000000000 --- a/0001-Fix-UI-tests-with-dist-vendored-dependencies.patch +++ /dev/null @@ -1,51 +0,0 @@ -From fb4d9ee194e4e6488dcbf9a7e4e16bb1e65ce5f2 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Mon, 8 Apr 2024 15:04:44 -0700 -Subject: [PATCH] Fix UI tests with dist-vendored dependencies - -There is already a workaround in `compiletest` to deal with custom -`CARGO_HOME` using `-Zignore-directory-in-diagnostics-source-blocks={}`. -A similar need exists when dependencies come from the local `vendor` -directory, which distro builds often use, so now we ignore that too. - -Also, `issue-21763.rs` was normalizing `hashbrown-` paths, presumably -expecting a version suffix, but the vendored path doesn't include the -version. Now that matches `[\\/]hashbrown` instead. - -(cherry picked from commit f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63) ---- - src/tools/compiletest/src/runtest.rs | 5 +++++ - tests/ui/issues/issue-21763.rs | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs -index 8be4def15ded..644775c0385c 100644 ---- a/src/tools/compiletest/src/runtest.rs -+++ b/src/tools/compiletest/src/runtest.rs -@@ -2362,6 +2362,11 @@ fn make_compile_args( - "ignore-directory-in-diagnostics-source-blocks={}", - home::cargo_home().expect("failed to find cargo home").to_str().unwrap() - )); -+ // Similarly, vendored sources shouldn't be shown when running from a dist tarball. -+ rustc.arg("-Z").arg(format!( -+ "ignore-directory-in-diagnostics-source-blocks={}", -+ self.config.find_rust_src_root().unwrap().join("vendor").display(), -+ )); - - // Optionally prevent default --sysroot if specified in test compile-flags. - if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) -diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/issues/issue-21763.rs -index 38103ff4f9c8..cc1a00687b30 100644 ---- a/tests/ui/issues/issue-21763.rs -+++ b/tests/ui/issues/issue-21763.rs -@@ -1,6 +1,6 @@ - // Regression test for HashMap only impl'ing Send/Sync if its contents do - --// normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION" -+// normalize-stderr-test: "\S+[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION" - - use std::collections::HashMap; - use std::rc::Rc; --- -2.44.0 - diff --git a/0001-Let-environment-variables-override-some-default-CPUs.patch b/0001-Let-environment-variables-override-some-default-CPUs.patch index dc8be55c7250f4da2dcd246ae5069cc79c8347af..302c7fdc7dfcc0431edc2bc64702fffb59f576e4 100644 --- a/0001-Let-environment-variables-override-some-default-CPUs.patch +++ b/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/0001-Only-translate-profile-flags-for-Clang.patch b/0001-Only-translate-profile-flags-for-Clang.patch new file mode 100644 index 0000000000000000000000000000000000000000..3353c1099473ea25934bbb1a545d9900497171d9 --- /dev/null +++ b/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/0001-Step-all-bootstrap-cfgs-forward.patch b/0001-Step-all-bootstrap-cfgs-forward.patch deleted file mode 100644 index bd0cd029028e5e736919dfb89cba5f44cfcedd37..0000000000000000000000000000000000000000 --- a/0001-Step-all-bootstrap-cfgs-forward.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9a5034a20ed8b055dc615271f9d9cf27f9e494f0 Mon Sep 17 00:00:00 2001 -From: Mark Rousskov -Date: Mon, 5 Feb 2024 07:34:48 -0500 -Subject: [PATCH] Step all bootstrap cfgs forward - -This also takes care of other bootstrap-related changes. ---- - src/tools/coverage-dump/src/covfun.rs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/tools/coverage-dump/src/covfun.rs b/src/tools/coverage-dump/src/covfun.rs -index 3a5866dea3e0..49e3a6ed5838 100644 ---- a/src/tools/coverage-dump/src/covfun.rs -+++ b/src/tools/coverage-dump/src/covfun.rs -@@ -219,7 +219,7 @@ pub(crate) fn decode(input: u32) -> Option { - enum MappingKind { - Code(CovTerm), - Gap(CovTerm), -- Expansion(u32), -+ Expansion(#[allow(dead_code)] u32), - Skip, - // Using raw identifiers here makes the dump output a little bit nicer - // (via the derived Debug), at the expense of making this tool's source --- -2.44.0 - diff --git a/0001-The-multiple_unsafe_ops_per_block-test-needs-asm.patch b/0001-The-multiple_unsafe_ops_per_block-test-needs-asm.patch deleted file mode 100644 index 71e6770461c3b62b98cfc42113c1443f1fc7637b..0000000000000000000000000000000000000000 --- a/0001-The-multiple_unsafe_ops_per_block-test-needs-asm.patch +++ /dev/null @@ -1,233 +0,0 @@ -From 29ed7749a3a0e4399b91b3d4198891a4d861f105 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Tue, 16 Apr 2024 16:45:59 -0700 -Subject: [PATCH] The `multiple_unsafe_ops_per_block` test needs `asm!` - -(cherry picked from commit 245fbeef49c2395471498d20e67f4edf4222c865) ---- - tests/ui/multiple_unsafe_ops_per_block.rs | 1 + - tests/ui/multiple_unsafe_ops_per_block.stderr | 58 +++++++++---------- - 2 files changed, 30 insertions(+), 29 deletions(-) - -diff --git a/tests/ui/multiple_unsafe_ops_per_block.rs b/tests/ui/multiple_unsafe_ops_per_block.rs -index 8afb4df20af4..6b8a103d4a94 100644 ---- a/tests/ui/multiple_unsafe_ops_per_block.rs -+++ b/tests/ui/multiple_unsafe_ops_per_block.rs -@@ -1,3 +1,4 @@ -+//@needs-asm-support - //@aux-build:proc_macros.rs - #![allow(unused)] - #![allow(deref_nullptr)] -diff --git a/tests/ui/multiple_unsafe_ops_per_block.stderr b/tests/ui/multiple_unsafe_ops_per_block.stderr -index 4803a5089ab2..f9b22c68ddb1 100644 ---- a/tests/ui/multiple_unsafe_ops_per_block.stderr -+++ b/tests/ui/multiple_unsafe_ops_per_block.stderr -@@ -1,5 +1,5 @@ - error: this `unsafe` block contains 2 unsafe operations, expected only one -- --> $DIR/multiple_unsafe_ops_per_block.rs:36:5 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:37:5 - | - LL | / unsafe { - LL | | STATIC += 1; -@@ -8,12 +8,12 @@ LL | | } - | |_____^ - | - note: modification of a mutable static occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:37:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:38:9 - | - LL | STATIC += 1; - | ^^^^^^^^^^^ - note: unsafe function call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:38:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:39:9 - | - LL | not_very_safe(); - | ^^^^^^^^^^^^^^^ -@@ -21,7 +21,7 @@ LL | not_very_safe(); - = help: to override `-D warnings` add `#[allow(clippy::multiple_unsafe_ops_per_block)]` - - error: this `unsafe` block contains 2 unsafe operations, expected only one -- --> $DIR/multiple_unsafe_ops_per_block.rs:45:5 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:46:5 - | - LL | / unsafe { - LL | | drop(u.u); -@@ -30,18 +30,18 @@ LL | | } - | |_____^ - | - note: union field access occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:46:14 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:47:14 - | - LL | drop(u.u); - | ^^^ - note: raw pointer dereference occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:47:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:48:9 - | - LL | *raw_ptr(); - | ^^^^^^^^^^ - - error: this `unsafe` block contains 3 unsafe operations, expected only one -- --> $DIR/multiple_unsafe_ops_per_block.rs:52:5 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:53:5 - | - LL | / unsafe { - LL | | asm!("nop"); -@@ -51,23 +51,23 @@ LL | | } - | |_____^ - | - note: inline assembly used here -- --> $DIR/multiple_unsafe_ops_per_block.rs:53:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:54:9 - | - LL | asm!("nop"); - | ^^^^^^^^^^^ - note: unsafe method call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:54:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:55:9 - | - LL | sample.not_very_safe(); - | ^^^^^^^^^^^^^^^^^^^^^^ - note: modification of a mutable static occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:55:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:56:9 - | - LL | STATIC = 0; - | ^^^^^^^^^^ - - error: this `unsafe` block contains 6 unsafe operations, expected only one -- --> $DIR/multiple_unsafe_ops_per_block.rs:61:5 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:62:5 - | - LL | / unsafe { - LL | | drop(u.u); -@@ -79,55 +79,55 @@ LL | | } - | |_____^ - | - note: union field access occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:62:14 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:63:14 - | - LL | drop(u.u); - | ^^^ - note: access of a mutable static occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:63:14 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:64:14 - | - LL | drop(STATIC); - | ^^^^^^ - note: unsafe method call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:64:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:65:9 - | - LL | sample.not_very_safe(); - | ^^^^^^^^^^^^^^^^^^^^^^ - note: unsafe function call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:65:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:66:9 - | - LL | not_very_safe(); - | ^^^^^^^^^^^^^^^ - note: raw pointer dereference occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:66:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:67:9 - | - LL | *raw_ptr(); - | ^^^^^^^^^^ - note: inline assembly used here -- --> $DIR/multiple_unsafe_ops_per_block.rs:67:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:68:9 - | - LL | asm!("nop"); - | ^^^^^^^^^^^ - - error: this `unsafe` block contains 2 unsafe operations, expected only one -- --> $DIR/multiple_unsafe_ops_per_block.rs:105:5 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:106:5 - | - LL | unsafe { char::from_u32_unchecked(*ptr.cast::()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - note: unsafe function call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:105:14 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:106:14 - | - LL | unsafe { char::from_u32_unchecked(*ptr.cast::()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - note: raw pointer dereference occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:105:39 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:106:39 - | - LL | unsafe { char::from_u32_unchecked(*ptr.cast::()) } - | ^^^^^^^^^^^^^^^^^^ - - error: this `unsafe` block contains 2 unsafe operations, expected only one -- --> $DIR/multiple_unsafe_ops_per_block.rs:123:5 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:124:5 - | - LL | / unsafe { - LL | | x(); -@@ -136,18 +136,18 @@ LL | | } - | |_____^ - | - note: unsafe function call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:124:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:125:9 - | - LL | x(); - | ^^^ - note: unsafe function call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:125:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:126:9 - | - LL | x(); - | ^^^ - - error: this `unsafe` block contains 2 unsafe operations, expected only one -- --> $DIR/multiple_unsafe_ops_per_block.rs:134:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:135:9 - | - LL | / unsafe { - LL | | T::X(); -@@ -156,18 +156,18 @@ LL | | } - | |_________^ - | - note: unsafe function call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:135:13 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:136:13 - | - LL | T::X(); - | ^^^^^^ - note: unsafe function call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:136:13 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:137:13 - | - LL | T::X(); - | ^^^^^^ - - error: this `unsafe` block contains 2 unsafe operations, expected only one -- --> $DIR/multiple_unsafe_ops_per_block.rs:144:5 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:145:5 - | - LL | / unsafe { - LL | | x.0(); -@@ -176,12 +176,12 @@ LL | | } - | |_____^ - | - note: unsafe function call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:145:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:146:9 - | - LL | x.0(); - | ^^^^^ - note: unsafe function call occurs here -- --> $DIR/multiple_unsafe_ops_per_block.rs:146:9 -+ --> $DIR/multiple_unsafe_ops_per_block.rs:147:9 - | - LL | x.0(); - | ^^^^^ --- -2.44.0 - diff --git a/0001-Use-lld-provided-by-system.patch b/0001-Use-lld-provided-by-system.patch index bee8e16d3f9007c027f246b2cee659becd5d3240..063d66a01f94c5b67d3e0c3bcea1ca86122b7889 100644 --- a/0001-Use-lld-provided-by-system.patch +++ b/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 { @@ -49,5 +76,5 @@ 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 -- -2.41.0 +2.46.0 diff --git a/0001-bootstrap-allow-disabling-target-self-contained.patch b/0001-bootstrap-allow-disabling-target-self-contained.patch index 2a3cbd705e1278422ccf3a42cdb2c98560744e26..34d735d4073bd68a945a8afc7351ba8bae78eb0e 100644 --- a/0001-bootstrap-allow-disabling-target-self-contained.patch +++ b/0001-bootstrap-allow-disabling-target-self-contained.patch @@ -1,4 +1,4 @@ -From df0d6f1d8b46db82d7599ca8eff6e8f844cf52f2 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,12 +11,12 @@ 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 e5df28a49af6..2fcd8b8cb057 100644 +index d3233ad17b51..6a1f097c20cb 100644 --- a/config.example.toml +++ b/config.example.toml -@@ -807,6 +807,11 @@ change-id = 116881 - # target triples containing `-none`, `nvptx`, `switch`, or `-uefi`. - #no-std = (bool) +@@ -916,6 +916,11 @@ + # argument as the test binary. + #runner = (string) +# Copy libc and CRT objects into the target lib/self-contained/ directory. +# Enabled by default on `musl`, `wasi`, and `windows-gnu` targets. Other @@ -27,10 +27,10 @@ index e5df28a49af6..2fcd8b8cb057 100644 # Distribution options # diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs -index 7021a9543582..11555c65ca87 100644 +index 8e088682f92d..843b7123b120 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs -@@ -302,6 +302,10 @@ fn copy_self_contained_objects( +@@ -346,6 +346,10 @@ fn copy_self_contained_objects( compiler: &Compiler, target: TargetSelection, ) -> Vec<(PathBuf, DependencyType)> { @@ -38,24 +38,24 @@ index 7021a9543582..11555c65ca87 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 0a9175aa3ea5..a2e028b25036 100644 +index e706aba977b6..a55d98e94dd8 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs -@@ -533,6 +533,7 @@ pub struct Target { - pub wasi_root: Option, - pub qemu_rootfs: Option, +@@ -627,6 +627,7 @@ pub struct Target { + pub runner: Option, pub no_std: bool, + pub codegen_backends: Option>, + pub self_contained: bool, } impl Target { -@@ -541,6 +542,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,15 +63,15 @@ index 0a9175aa3ea5..a2e028b25036 100644 target } } -@@ -1051,6 +1055,7 @@ struct TomlTarget { - wasi_root: Option = "wasi-root", - qemu_rootfs: Option = "qemu-rootfs", +@@ -1213,6 +1217,7 @@ struct TomlTarget { no_std: Option = "no-std", + codegen_backends: Option> = "codegen-backends", + runner: Option = "runner", + self_contained: Option = "self-contained", } } -@@ -1600,6 +1605,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 0a9175aa3ea5..a2e028b25036 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 33b8f1a7ce72..f36e53187576 100644 +index c384fd6bf435..a101c010b740 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs -@@ -1335,6 +1335,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 33b8f1a7ce72..f36e53187576 100644 /// and `remote-test-server` binaries. fn remote_tested(&self, target: TargetSelection) -> bool { -- -2.41.0 +2.47.1 diff --git a/0001-bootstrap-move-all-of-rustc-s-flags-to-rustc_cargo.patch b/0001-bootstrap-move-all-of-rustc-s-flags-to-rustc_cargo.patch deleted file mode 100644 index baceb2f6ff48cfb703798aaf4d278e64b64cb807..0000000000000000000000000000000000000000 --- a/0001-bootstrap-move-all-of-rustc-s-flags-to-rustc_cargo.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 56942ed6d13d330facddbd71470a3c115a3fe0d1 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Fri, 5 Apr 2024 15:07:58 -0700 -Subject: [PATCH] bootstrap: move all of rustc's flags to `rustc_cargo` - -This ensures that `RUSTFLAGS` will be consistent between all modes of -building the compiler, so they won't trigger a rebuild by cargo. This -kind of fix was started in #119414 just for LTO flags, but it's -applicable to all kinds of flags that might be configured. - -(cherry picked from commit e8fb8c36ca0de817b3d30f603d6d6b3c56e8b0be) ---- - src/bootstrap/src/core/build_steps/check.rs | 2 +- - src/bootstrap/src/core/build_steps/compile.rs | 107 +++++++++--------- - src/bootstrap/src/core/build_steps/doc.rs | 2 +- - src/bootstrap/src/core/build_steps/test.rs | 2 +- - 4 files changed, 59 insertions(+), 54 deletions(-) - -diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs -index 5f0afdb1b36c..dd866c2eb0f3 100644 ---- a/src/bootstrap/src/core/build_steps/check.rs -+++ b/src/bootstrap/src/core/build_steps/check.rs -@@ -263,7 +263,7 @@ fn run(self, builder: &Builder<'_>) { - target, - cargo_subcommand(builder.kind), - ); -- rustc_cargo(builder, &mut cargo, target, compiler.stage); -+ rustc_cargo(builder, &mut cargo, target, &compiler); - - // For ./x.py clippy, don't run with --all-targets because - // linting tests and benchmarks can produce very noisy results -diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs -index ddbe18ab8388..607a658617b5 100644 ---- a/src/bootstrap/src/core/build_steps/compile.rs -+++ b/src/bootstrap/src/core/build_steps/compile.rs -@@ -898,55 +898,10 @@ fn run(self, builder: &Builder<'_>) -> u32 { - )); - - let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "build"); -- rustc_cargo(builder, &mut cargo, target, compiler.stage); -+ rustc_cargo(builder, &mut cargo, target, &compiler); - -- if builder.config.rust_profile_use.is_some() -- && builder.config.rust_profile_generate.is_some() -- { -- panic!("Cannot use and generate PGO profiles at the same time"); -- } -- -- // With LLD, we can use ICF (identical code folding) to reduce the executable size -- // of librustc_driver/rustc and to improve i-cache utilization. -- // -- // -Wl,[link options] doesn't work on MSVC. However, /OPT:ICF (technically /OPT:REF,ICF) -- // is already on by default in MSVC optimized builds, which is interpreted as --icf=all: -- // https://github.com/llvm/llvm-project/blob/3329cec2f79185bafd678f310fafadba2a8c76d2/lld/COFF/Driver.cpp#L1746 -- // https://github.com/rust-lang/rust/blob/f22819bcce4abaff7d1246a56eec493418f9f4ee/compiler/rustc_codegen_ssa/src/back/linker.rs#L827 -- if builder.config.lld_mode.is_used() && !compiler.host.is_msvc() { -- cargo.rustflag("-Clink-args=-Wl,--icf=all"); -- } -- -- let is_collecting = if let Some(path) = &builder.config.rust_profile_generate { -- if compiler.stage == 1 { -- cargo.rustflag(&format!("-Cprofile-generate={path}")); -- // Apparently necessary to avoid overflowing the counters during -- // a Cargo build profile -- cargo.rustflag("-Cllvm-args=-vp-counters-per-site=4"); -- true -- } else { -- false -- } -- } else if let Some(path) = &builder.config.rust_profile_use { -- if compiler.stage == 1 { -- cargo.rustflag(&format!("-Cprofile-use={path}")); -- if builder.is_verbose() { -- cargo.rustflag("-Cllvm-args=-pgo-warn-missing-function"); -- } -- true -- } else { -- false -- } -- } else { -- false -- }; -- if is_collecting { -- // Ensure paths to Rust sources are relative, not absolute. -- cargo.rustflag(&format!( -- "-Cllvm-args=-static-func-strip-dirname-prefix={}", -- builder.config.src.components().count() -- )); -- } -+ // NB: all RUSTFLAGS should be added to `rustc_cargo()` so they will be -+ // consistently applied by check/doc/test modes too. - - for krate in &*self.crates { - cargo.arg("-p").arg(krate); -@@ -997,7 +952,12 @@ fn run(self, builder: &Builder<'_>) -> u32 { - } - } - --pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection, stage: u32) { -+pub fn rustc_cargo( -+ builder: &Builder<'_>, -+ cargo: &mut Cargo, -+ target: TargetSelection, -+ compiler: &Compiler, -+) { - cargo - .arg("--features") - .arg(builder.rustc_features(builder.kind)) -@@ -1008,7 +968,7 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec - - // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary - // and may just be a time sink. -- if stage != 0 { -+ if compiler.stage != 0 { - match builder.config.rust_lto { - RustcLto::Thin | RustcLto::Fat => { - // Since using LTO for optimizing dylibs is currently experimental, -@@ -1034,7 +994,52 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec - cargo.rustflag("-Clto=off"); - } - -- rustc_cargo_env(builder, cargo, target, stage); -+ // With LLD, we can use ICF (identical code folding) to reduce the executable size -+ // of librustc_driver/rustc and to improve i-cache utilization. -+ // -+ // -Wl,[link options] doesn't work on MSVC. However, /OPT:ICF (technically /OPT:REF,ICF) -+ // is already on by default in MSVC optimized builds, which is interpreted as --icf=all: -+ // https://github.com/llvm/llvm-project/blob/3329cec2f79185bafd678f310fafadba2a8c76d2/lld/COFF/Driver.cpp#L1746 -+ // https://github.com/rust-lang/rust/blob/f22819bcce4abaff7d1246a56eec493418f9f4ee/compiler/rustc_codegen_ssa/src/back/linker.rs#L827 -+ if builder.config.lld_mode.is_used() && !compiler.host.is_msvc() { -+ cargo.rustflag("-Clink-args=-Wl,--icf=all"); -+ } -+ -+ if builder.config.rust_profile_use.is_some() && builder.config.rust_profile_generate.is_some() { -+ panic!("Cannot use and generate PGO profiles at the same time"); -+ } -+ let is_collecting = if let Some(path) = &builder.config.rust_profile_generate { -+ if compiler.stage == 1 { -+ cargo.rustflag(&format!("-Cprofile-generate={path}")); -+ // Apparently necessary to avoid overflowing the counters during -+ // a Cargo build profile -+ cargo.rustflag("-Cllvm-args=-vp-counters-per-site=4"); -+ true -+ } else { -+ false -+ } -+ } else if let Some(path) = &builder.config.rust_profile_use { -+ if compiler.stage == 1 { -+ cargo.rustflag(&format!("-Cprofile-use={path}")); -+ if builder.is_verbose() { -+ cargo.rustflag("-Cllvm-args=-pgo-warn-missing-function"); -+ } -+ true -+ } else { -+ false -+ } -+ } else { -+ false -+ }; -+ if is_collecting { -+ // Ensure paths to Rust sources are relative, not absolute. -+ cargo.rustflag(&format!( -+ "-Cllvm-args=-static-func-strip-dirname-prefix={}", -+ builder.config.src.components().count() -+ )); -+ } -+ -+ rustc_cargo_env(builder, cargo, target, compiler.stage); - } - - pub fn rustc_cargo_env( -diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs -index 57e63927c95e..e10035f07c05 100644 ---- a/src/bootstrap/src/core/build_steps/doc.rs -+++ b/src/bootstrap/src/core/build_steps/doc.rs -@@ -794,7 +794,7 @@ fn run(self, builder: &Builder<'_>) { - cargo.rustdocflag("-Znormalize-docs"); - cargo.rustdocflag("--show-type-layout"); - cargo.rustdocflag("--generate-link-to-definition"); -- compile::rustc_cargo(builder, &mut cargo, target, compiler.stage); -+ compile::rustc_cargo(builder, &mut cargo, target, &compiler); - cargo.arg("-Zunstable-options"); - cargo.arg("-Zskip-rustdoc-fingerprint"); - -diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs -index 04728e2e00dc..c4fdda0a2606 100644 ---- a/src/bootstrap/src/core/build_steps/test.rs -+++ b/src/bootstrap/src/core/build_steps/test.rs -@@ -2558,7 +2558,7 @@ fn run(self, builder: &Builder<'_>) { - } - } - Mode::Rustc => { -- compile::rustc_cargo(builder, &mut cargo, target, compiler.stage); -+ compile::rustc_cargo(builder, &mut cargo, target, &compiler); - } - _ => panic!("can only test libraries"), - }; --- -2.44.0 - diff --git a/0001-remove-stderr-per-bitwidth-from-some-tests.patch b/0001-remove-stderr-per-bitwidth-from-some-tests.patch deleted file mode 100644 index 57a0c1f833d5da57d478e5eacd0b65361b8e3399..0000000000000000000000000000000000000000 --- a/0001-remove-stderr-per-bitwidth-from-some-tests.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 96e7b2767b30c215361d26626ef235f5ec0e8cd5 Mon Sep 17 00:00:00 2001 -From: Ralf Jung -Date: Fri, 16 Feb 2024 10:01:43 +0100 -Subject: [PATCH] remove stderr-per-bitwidth from some tests - -(cherry picked from commit f68e79dcac3acb635c58ff2fa4178b9a0b040fe4) ---- - ...ut_ref_in_final_dynamic_check.64bit.stderr | 20 ------------------- - .../mut_ref_in_final_dynamic_check.rs | 3 ++- - ... => mut_ref_in_final_dynamic_check.stderr} | 8 ++++---- - 3 files changed, 6 insertions(+), 25 deletions(-) - delete mode 100644 tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr - rename tests/ui/consts/const-mut-refs/{mut_ref_in_final_dynamic_check.32bit.stderr => mut_ref_in_final_dynamic_check.stderr} (75%) - -diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr -deleted file mode 100644 -index fc68207512c0..000000000000 ---- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.64bit.stderr -+++ /dev/null -@@ -1,20 +0,0 @@ --error[E0080]: it is undefined behavior to use this value -- --> $DIR/mut_ref_in_final_dynamic_check.rs:15:1 -- | --LL | const A: Option<&mut i32> = helper(); -- | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered mutable reference in a `const` or `static` -- | -- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. -- = note: the raw bytes of the constant (size: 8, align: 8) { -- 2a 00 00 00 00 00 00 00 │ *....... -- } -- --error: encountered dangling pointer in final value of constant -- --> $DIR/mut_ref_in_final_dynamic_check.rs:22:1 -- | --LL | const B: Option<&mut i32> = helper2(); -- | ^^^^^^^^^^^^^^^^^^^^^^^^^ -- --error: aborting due to 2 previous errors -- --For more information about this error, try `rustc --explain E0080`. -diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs -index 455b557b97c4..b98f4d920694 100644 ---- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs -+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs -@@ -1,4 +1,5 @@ --// stderr-per-bitwidth -+// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" -+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?()?─*╼ )+ *│.*" -> "HEX_DUMP" - #![feature(const_mut_refs)] - #![feature(raw_ref_op)] - -diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr -similarity index 75% -rename from tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr -rename to tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr -index 87420a037514..bb3c5518680b 100644 ---- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.32bit.stderr -+++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr -@@ -1,16 +1,16 @@ - error[E0080]: it is undefined behavior to use this value -- --> $DIR/mut_ref_in_final_dynamic_check.rs:15:1 -+ --> $DIR/mut_ref_in_final_dynamic_check.rs:16:1 - | - LL | const A: Option<&mut i32> = helper(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at ..0: encountered mutable reference in a `const` or `static` - | - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. -- = note: the raw bytes of the constant (size: 4, align: 4) { -- 2a 00 00 00 │ *... -+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { -+ HEX_DUMP - } - - error: encountered dangling pointer in final value of constant -- --> $DIR/mut_ref_in_final_dynamic_check.rs:22:1 -+ --> $DIR/mut_ref_in_final_dynamic_check.rs:23:1 - | - LL | const B: Option<&mut i32> = helper2(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ --- -2.44.0 - diff --git a/0001-test-don-t-compress-test-registry-crates.patch b/0001-test-don-t-compress-test-registry-crates.patch deleted file mode 100644 index 60f2f275c93215c009dc17c384b694ac9b258f87..0000000000000000000000000000000000000000 --- a/0001-test-don-t-compress-test-registry-crates.patch +++ /dev/null @@ -1,185 +0,0 @@ -From ed8e223cc58103cae0586351fd9113a727523cab Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Thu, 11 Apr 2024 14:58:42 -0700 -Subject: [PATCH] test: don't compress test registry crates - -They are still nominally gzipped, but using `Compression::none()` makes -them consistent even across zlib and zlib-ng, and this fixes checksum -differences in the testsuite. There is a one-time update of all those -checksums to catch up with this change though. - -(cherry picked from commit a70f23c50b61c1a3335f2943375a04ae7abf2fa4) ---- - crates/cargo-test-support/src/registry.rs | 2 +- - tests/testsuite/alt_registry.rs | 2 +- - .../cargo_add/locked_unchanged/in/Cargo.lock | 2 +- - .../cargo_add/lockfile_updated/in/Cargo.lock | 2 +- - .../cargo_add/lockfile_updated/out/Cargo.lock | 4 ++-- - .../cargo_remove/update_lock_file/in/Cargo.lock | 16 ++++++++-------- - .../cargo_remove/update_lock_file/out/Cargo.lock | 12 ++++++------ - 7 files changed, 20 insertions(+), 20 deletions(-) - -diff --git a/crates/cargo-test-support/src/registry.rs b/crates/cargo-test-support/src/registry.rs -index cc51707dbbf9..e27d1e354d7b 100644 ---- a/crates/cargo-test-support/src/registry.rs -+++ b/crates/cargo-test-support/src/registry.rs -@@ -1469,7 +1469,7 @@ impl Package { - let dst = self.archive_dst(); - t!(fs::create_dir_all(dst.parent().unwrap())); - let f = t!(File::create(&dst)); -- let mut a = Builder::new(GzEncoder::new(f, Compression::default())); -+ let mut a = Builder::new(GzEncoder::new(f, Compression::none())); - - if !self - .files -diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs -index f286dc018122..42b818493244 100644 ---- a/tests/testsuite/alt_registry.rs -+++ b/tests/testsuite/alt_registry.rs -@@ -1466,7 +1466,7 @@ dependencies = [ - name = "foo" - version = "0.1.0" - source = "sparse+http://[..]/" --checksum = "f6a200a9339fef960979d94d5c99cbbfd899b6f5a396a55d9775089119050203""#, -+checksum = "458c1addb23fde7dfbca0410afdbcc0086f96197281ec304d9e0e10def3cb899""#, - ); - } - -diff --git a/tests/testsuite/cargo_add/locked_unchanged/in/Cargo.lock b/tests/testsuite/cargo_add/locked_unchanged/in/Cargo.lock -index 011b335926ee..b88709a9e9be 100644 ---- a/tests/testsuite/cargo_add/locked_unchanged/in/Cargo.lock -+++ b/tests/testsuite/cargo_add/locked_unchanged/in/Cargo.lock -@@ -13,4 +13,4 @@ dependencies = [ - name = "my-package" - version = "99999.0.0+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "62c45acf9e11d2f97f5b318143219c0b4102eafef1c22a4b545b47104691d915" -+checksum = "73cfa03cf28feb001362b377a837910c5a6ec1cc5cceaa562b97fc14d15edec8" -diff --git a/tests/testsuite/cargo_add/lockfile_updated/in/Cargo.lock b/tests/testsuite/cargo_add/lockfile_updated/in/Cargo.lock -index d9bcc988d3f2..d8fa962f3069 100644 ---- a/tests/testsuite/cargo_add/lockfile_updated/in/Cargo.lock -+++ b/tests/testsuite/cargo_add/lockfile_updated/in/Cargo.lock -@@ -14,4 +14,4 @@ dependencies = [ - name = "unrelateed-crate" - version = "0.2.0+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "266de4849a570b5dfda5e8e082a2aff885e9d2d4965dae8f8b6c8535e1ec731f" -+checksum = "b16af1a8ba7e4331ca62d945483a3028c2afbbe06a7f2ffaa0a3538ef0a7d63e" -diff --git a/tests/testsuite/cargo_add/lockfile_updated/out/Cargo.lock b/tests/testsuite/cargo_add/lockfile_updated/out/Cargo.lock -index 4b5fb465f104..e423b3d1f8b7 100644 ---- a/tests/testsuite/cargo_add/lockfile_updated/out/Cargo.lock -+++ b/tests/testsuite/cargo_add/lockfile_updated/out/Cargo.lock -@@ -14,10 +14,10 @@ dependencies = [ - name = "my-package" - version = "99999.0.0+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "62c45acf9e11d2f97f5b318143219c0b4102eafef1c22a4b545b47104691d915" -+checksum = "73cfa03cf28feb001362b377a837910c5a6ec1cc5cceaa562b97fc14d15edec8" - - [[package]] - name = "unrelateed-crate" - version = "0.2.0+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "266de4849a570b5dfda5e8e082a2aff885e9d2d4965dae8f8b6c8535e1ec731f" -+checksum = "b16af1a8ba7e4331ca62d945483a3028c2afbbe06a7f2ffaa0a3538ef0a7d63e" -diff --git a/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock b/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock -index 2302220f2fb7..a4018e70eb47 100644 ---- a/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock -+++ b/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock -@@ -19,40 +19,40 @@ dependencies = [ - name = "clippy" - version = "0.4.1+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "47ced0eda54e9ddc6063f0e1d0164493cd16c84c6b6a0329a536967c44e205f7" -+checksum = "e95568c5ce98de9c470c1d9b387466f4d5efa9687d3af7998e7c9c1da5e399fb" - - [[package]] - name = "docopt" - version = "0.6.2+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "b600540c4fafb27bf6e6961f0f1e6f547c9d6126ce581ab3a92f878c8e2c9a2c" -+checksum = "d4414d2705e6b42fe10772b4ab4e3260f362669e45606eb562dc4c0023e911f6" - - [[package]] - name = "regex" - version = "0.1.1+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "84949cb53285a6c481d0133065a7b669871acfd9e20f273f4ce1283c309775d5" -+checksum = "bc4552a1d503f3a436bb18d1efff62eb95bd97f724d06466c55ef151ea2de9e0" - - [[package]] - name = "rustc-serialize" --version = "0.4.1+my-package" -+version = "0.4.0+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "31162e7d23a085553c42dee375787b451a481275473f7779c4a63bcc267a24fd" -+checksum = "48c3645ec42f69a343fbe9734a477ae59448192e779206dbcb1a9c3397563fd8" - - [[package]] - name = "semver" - version = "0.1.1" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "106bee742e3199d9e59f4269e458dfc825c1b4648c483b1c2b7a45cd2610a308" -+checksum = "20070289360e74dcdc28f437b08dda0c0c861c2328d749bb0d6e1a428013af83" - - [[package]] - name = "serde" - version = "1.0.90" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "be7d269f612a60e3c2c4a4a120e2d878a3f3298a5285eda6e95453905a107d9a" -+checksum = "ba76b226746eabf28375d5ad184926bbb9cd727425c8d027ea10f6c508895c6c" - - [[package]] - name = "toml" - version = "0.1.1+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "a0f6c7804525ce0a968ef270e55a516cf4bdcf1fea0b09d130e0aa34a66745b3" -+checksum = "a9ea5fa6eaed7d7e6d9fb4571bb9d915b577e19bf2a95321ebb70fd3d894ce49" -diff --git a/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock b/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock -index 0946cee47717..af60414ddad2 100644 ---- a/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock -+++ b/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock -@@ -18,34 +18,34 @@ dependencies = [ - name = "clippy" - version = "0.4.1+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "47ced0eda54e9ddc6063f0e1d0164493cd16c84c6b6a0329a536967c44e205f7" -+checksum = "e95568c5ce98de9c470c1d9b387466f4d5efa9687d3af7998e7c9c1da5e399fb" - - [[package]] - name = "docopt" - version = "0.6.2+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "b600540c4fafb27bf6e6961f0f1e6f547c9d6126ce581ab3a92f878c8e2c9a2c" -+checksum = "d4414d2705e6b42fe10772b4ab4e3260f362669e45606eb562dc4c0023e911f6" - - [[package]] - name = "regex" - version = "0.1.1+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "84949cb53285a6c481d0133065a7b669871acfd9e20f273f4ce1283c309775d5" -+checksum = "bc4552a1d503f3a436bb18d1efff62eb95bd97f724d06466c55ef151ea2de9e0" - - [[package]] - name = "semver" - version = "0.1.1" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "106bee742e3199d9e59f4269e458dfc825c1b4648c483b1c2b7a45cd2610a308" -+checksum = "20070289360e74dcdc28f437b08dda0c0c861c2328d749bb0d6e1a428013af83" - - [[package]] - name = "serde" - version = "1.0.90" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "be7d269f612a60e3c2c4a4a120e2d878a3f3298a5285eda6e95453905a107d9a" -+checksum = "ba76b226746eabf28375d5ad184926bbb9cd727425c8d027ea10f6c508895c6c" - - [[package]] - name = "toml" - version = "0.1.1+my-package" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "a0f6c7804525ce0a968ef270e55a516cf4bdcf1fea0b09d130e0aa34a66745b3" -+checksum = "a9ea5fa6eaed7d7e6d9fb4571bb9d915b577e19bf2a95321ebb70fd3d894ce49" --- -2.44.0 - diff --git a/0002-set-an-external-library-path-for-wasm32-wasi.patch b/0002-set-an-external-library-path-for-wasm32-wasi.patch index e2da2fe53612794766355ead2467b7d28f97a0f4..3a05424736e6b217e3a8439e233d193c0800ca92 100644 --- a/0002-set-an-external-library-path-for-wasm32-wasi.patch +++ b/0002-set-an-external-library-path-for-wasm32-wasi.patch @@ -1,19 +1,19 @@ -From 79bb610c8fc5d9df7dd4720ae847b8f17e7b1ad4 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 | 2 ++ - compiler/rustc_target/src/spec/targets/wasm32_wasi.rs | 6 +++++- - 3 files changed, 16 insertions(+), 1 deletion(-) + 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 dd9d277fb775..3d0f0502f255 100644 +index 5149e3a12f23..cf62fbdc7f59 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs -@@ -1496,6 +1496,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 dd9d277fb775..3d0f0502f255 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() { -@@ -1982,6 +1988,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 dd9d277fb775..3d0f0502f255 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 f04799482c83..25410b37ba24 100644 +index 321ab40403a3..54791c8892d8 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs -@@ -1874,6 +1874,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 f04799482c83..25410b37ba24 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, -@@ -2352,6 +2353,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,23 +57,42 @@ index f04799482c83..25410b37ba24 100644 pre_link_objects_self_contained: Default::default(), post_link_objects_self_contained: Default::default(), link_self_contained: LinkSelfContainedDefault::False, -diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs -index 6dbcb01ea436..2151f86d0648 100644 ---- a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs -+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs -@@ -86,7 +86,11 @@ pub fn target() -> Target { - options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained(); +@@ -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); ++ key!(external_lib_path, optional); + key!(pre_link_objects_self_contained = "pre-link-objects-fallback", link_objects); + key!(post_link_objects_self_contained = "post-link-objects-fallback", link_objects); + // Deserializes the backwards-compatible variants of `-Clink-self-contained` +@@ -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); ++ target_option_val!(external_lib_path); + target_option_val!(pre_link_objects_self_contained, "pre-link-objects-fallback"); + target_option_val!(post_link_objects_self_contained, "post-link-objects-fallback"); + target_option_val!(link_args - pre_link_args_json, "pre-link-args"); +diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs +index 1cd30f21bec1..9a752d5712a6 100644 +--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs ++++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs +@@ -19,11 +19,12 @@ pub(crate) fn target() -> Target { + 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(); ++ options.pre_link_objects = crt_objects::pre_wasi_self_contained(); ++ options.post_link_objects = crt_objects::post_wasi_self_contained(); // FIXME: Figure out cases in which WASM needs to link with a native toolchain. - options.link_self_contained = LinkSelfContainedDefault::True; + options.link_self_contained = LinkSelfContainedDefault::False; -+ -+ options.pre_link_objects = options.pre_link_objects_self_contained.clone(); -+ options.post_link_objects = options.post_link_objects_self_contained.clone(); + options.external_lib_path = Some("/usr/wasm32-wasi/lib/wasm32-wasi".into()); // 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.41.0 +2.47.1 diff --git a/120529.patch b/120529.patch deleted file mode 100644 index 9e53295c3699f164e700ccd93d59b32ed866af19..0000000000000000000000000000000000000000 --- a/120529.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 8eb48b4f4c6e3d48f2600159a75184ec4d74b249 Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Wed, 31 Jan 2024 15:08:08 +0100 -Subject: [PATCH] Update data layouts in custom target tests for LLVM 18 - -Fixes https://github.com/rust-lang/rust/issues/120492. ---- - tests/run-make/rust-lld-custom-target/custom-target.json | 2 +- - tests/run-make/rustdoc-target-spec-json-path/target.json | 2 +- - tests/run-make/target-specs/my-awesome-platform.json | 2 +- - .../target-specs/my-x86_64-unknown-linux-gnu-platform.json | 2 +- - 4 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/tests/run-make/rust-lld-custom-target/custom-target.json b/tests/run-make/rust-lld-custom-target/custom-target.json -index 7828a99f235c1..e2c64cbdb43c2 100644 ---- a/tests/run-make/rust-lld-custom-target/custom-target.json -+++ b/tests/run-make/rust-lld-custom-target/custom-target.json -@@ -2,7 +2,7 @@ - "arch": "x86_64", - "cpu": "x86-64", - "crt-static-respected": true, -- "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", -+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", - "dynamic-linking": true, - "env": "gnu", - "has-rpath": true, -diff --git a/tests/run-make/rustdoc-target-spec-json-path/target.json b/tests/run-make/rustdoc-target-spec-json-path/target.json -index 34357182c205e..c478f1196fae0 100644 ---- a/tests/run-make/rustdoc-target-spec-json-path/target.json -+++ b/tests/run-make/rustdoc-target-spec-json-path/target.json -@@ -2,7 +2,7 @@ - "arch": "x86_64", - "cpu": "x86-64", - "crt-static-respected": true, -- "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", -+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", - "dynamic-linking": true, - "env": "gnu", - "executables": true, -diff --git a/tests/run-make/target-specs/my-awesome-platform.json b/tests/run-make/target-specs/my-awesome-platform.json -index 00de3de05f07a..1673ef7bd54d1 100644 ---- a/tests/run-make/target-specs/my-awesome-platform.json -+++ b/tests/run-make/target-specs/my-awesome-platform.json -@@ -1,5 +1,5 @@ - { -- "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", -+ "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", - "linker-flavor": "gcc", - "llvm-target": "i686-unknown-linux-gnu", - "target-endian": "little", -diff --git a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json -index 6d5e964ed4fee..0cafce15a9fef 100644 ---- a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json -+++ b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json -@@ -1,6 +1,6 @@ - { - "pre-link-args": {"gcc": ["-m64"]}, -- "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", -+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", - "linker-flavor": "gcc", - "llvm-target": "x86_64-unknown-linux-gnu", - "target-endian": "little", diff --git a/121088.patch b/121088.patch deleted file mode 100644 index b70b52a78189eefcf4511dec9041f480ec292300..0000000000000000000000000000000000000000 --- a/121088.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 369fff6c0640fe89be9b915adaa83e66a022e00d Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Wed, 14 Feb 2024 16:26:20 +0100 -Subject: [PATCH] Implicitly enable evex512 if avx512 is enabled - -LLVM 18 requires the evex512 feature to allow use of zmm registers. -LLVM automatically sets it when using a generic CPU, but not when -`-C target-cpu` is specified. This will result either in backend -legalization crashes, or code unexpectedly using ymm instead of -zmm registers. - -For now, make sure that `avx512*` features imply `evex512`. Long -term we'll probably have to deal with the AVX10 mess somehow. ---- - compiler/rustc_codegen_llvm/src/llvm_util.rs | 4 ++++ - tests/ui/asm/x86_64/evex512-implicit-feature.rs | 15 +++++++++++++++ - 2 files changed, 19 insertions(+) - create mode 100644 tests/ui/asm/x86_64/evex512-implicit-feature.rs - -diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs -index e48479c8da279..54e8ed85e3250 100644 ---- a/compiler/rustc_codegen_llvm/src/llvm_util.rs -+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs -@@ -266,6 +266,10 @@ pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> LLVMFeature<'a> { - ("riscv32" | "riscv64", "fast-unaligned-access") if get_version().0 <= 17 => { - LLVMFeature::new("unaligned-scalar-mem") - } -+ // For LLVM 18, enable the evex512 target feature if a avx512 target feature is enabled. -+ ("x86", s) if get_version().0 >= 18 && s.starts_with("avx512") => { -+ LLVMFeature::with_dependency(s, TargetFeatureFoldStrength::EnableOnly("evex512")) -+ } - (_, s) => LLVMFeature::new(s), - } - } -diff --git a/tests/ui/asm/x86_64/evex512-implicit-feature.rs b/tests/ui/asm/x86_64/evex512-implicit-feature.rs -new file mode 100644 -index 0000000000000..a15060857eccb ---- /dev/null -+++ b/tests/ui/asm/x86_64/evex512-implicit-feature.rs -@@ -0,0 +1,15 @@ -+// build-pass -+// only-x86_64 -+// compile-flags: --crate-type=lib -C target-cpu=skylake -+ -+#![feature(avx512_target_feature)] -+#![feature(stdarch_x86_avx512)] -+ -+use std::arch::x86_64::*; -+ -+#[target_feature(enable = "avx512f")] -+#[no_mangle] -+pub unsafe fn test(res: *mut f64, p: *const f64) { -+ let arg = _mm512_load_pd(p); -+ _mm512_store_pd(res, _mm512_fmaddsub_pd(arg, arg, arg)); -+} diff --git a/README.md b/README.md deleted file mode 100644 index 7342728d557c602f51c6d278bba9f3dd9faaf356..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1,11 +0,0 @@ -Anolis OS -======================================= -# 代码仓库说明 -## 分支说明 ->进行代码开发工作时,请注意选择当前版本对应的分支 -* aX分支为对应大版本的主分支,如a8分支对应当前最新版本 -* aX.Y分支为对应小版本的维护分支,如a8.2分支对应8.2版本 -## 开发流程 -1. 首先fork目标分支到自己的namespace -2. 在自己的fork分支上做出修改 -3. 向对应的仓库中提交merge request,源分支为fork分支 diff --git a/macros.rust-toolset b/macros.rust-toolset index 396f6c360cedbace5214316f0477fb7a30f002d1..135b3e2ade00816a501d7a3c0353927adbc9f53b 100644 --- a/macros.rust-toolset +++ b/macros.rust-toolset @@ -48,7 +48,7 @@ # __cargo: cargo command with environment variables # -# CARGO_HOME: This ensures cargo reads configuration file from .cargo/config, +# CARGO_HOME: This ensures cargo reads configuration file from .cargo/config.toml, # and prevents writing any files to $HOME during RPM builds. %__cargo /usr/bin/env CARGO_HOME=.cargo RUSTFLAGS='%{build_rustflags}' /usr/bin/cargo @@ -61,7 +61,7 @@ # # This involves four steps: # - create the ".cargo" directory if it doesn't exist yet -# - dump custom cargo configuration into ".cargo/config" +# - dump custom cargo configuration into ".cargo/config.toml" # - remove "Cargo.lock" if it exists (it breaks builds with custom cargo config) # - remove "Cargo.toml.orig" if it exists (it breaks running "cargo package") # @@ -79,7 +79,7 @@ set -euo pipefail\ /usr/bin/ln -s rpm target/release\ %{__rm} -rf .cargo/\ %{__mkdir} -p .cargo\ -cat > .cargo/config << EOF\ +cat > .cargo/config.toml << EOF\ [build]\ rustc = "%{__rustc}"\ rustdoc = "%{__rustdoc}"\ @@ -104,7 +104,7 @@ verbose = true\ EOF\ %{-V:%{__tar} -xoaf %{S:%{-V*}}}\ %{!?-N:\ -cat >> .cargo/config << EOF\ +cat >> .cargo/config.toml << EOF\ [source.vendored-sources]\ directory = "%{-v*}%{-V:./vendor}"\ \ diff --git a/rust.spec b/rust.spec index 85f276ed75e8bd6f92549897cb72b1dd00a4de91..bf4a6dd60dfcedca04a365c6cbefa063306ca5c5 100644 --- a/rust.spec +++ b/rust.spec @@ -1,24 +1,22 @@ -%define anolis_release 1 +%global anolis_release 1 Name: rust -Version: 1.77.2 +Version: 1.84.1 Release: %{anolis_release}%{?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) URL: https://www.rust-lang.org -# Only x86_64, i686, and aarch64 are Tier 1 platforms at this time. -# https://doc.rust-lang.org/nightly/rustc/platform-support.html -%global rust_arches x86_64 aarch64 loongarch64 +%global rust_arches x86_64 aarch64 riscv64 loongarch64 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.76.0 -%global bootstrap_channel 1.76.0 -%global bootstrap_date 2024-02-08 +%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 @@ -31,12 +29,13 @@ ExclusiveArch: %{rust_arches} # cross-compilation. The packages are noarch, but they're not fully # reproducible between hosts, so only x86_64 actually builds it. %ifarch x86_64 -#%%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu -%global wasm_targets wasm32-unknown-unknown wasm32-wasi +%global wasm_targets wasm32-unknown-unknown wasm32-wasip1 %global extra_targets x86_64-unknown-none x86_64-unknown-uefi %endif +%ifarch aarch64 +%global extra_targets aarch64-unknown-none-softfloat +%endif %global all_targets %{?wasm_targets} %{?extra_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) } @@ -44,41 +43,45 @@ ExclusiveArch: %{rust_arches} # 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-21 -%global wasi_libc_ref 03b228e46bb02fcc5927253e1b8ad715072b1ae4 +%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} -#%%bcond_with bundled_wasi_libc %bcond_without bundled_wasi_libc # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. %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 15.0+. -%global min_llvm_version 15.0.0 -%global bundled_llvm_version 17.0.6 +# is insufficient. Rust currently requires LLVM 18.0+. +# Enable compat llvm18 on Anolis OS 23.3 and later +%global min_llvm_version 18.0.0 +%global bundled_llvm_version 19.1.5 +%global llvm_compat_version 18 +%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 -%bcond_with bundled_libgit2 -#%%bcond_without bundled_libgit2 +%global min_libgit2_version 1.8.1 +%global next_libgit2_version 1.9.0~ +%global bundled_libgit2_version 1.8.1 +%bcond_without bundled_libgit2 + +# 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 +%bcond_with bundled_oniguruma + +# Cargo uses UPSERTs with omitted conflict targets +%global min_sqlite3_version 3.35 +%global bundled_sqlite3_version 3.46.0 +%bcond_with bundled_sqlite3 # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -#%%bcond_without disabled_libssh2 %bcond_with disabled_libssh2 -# Reduce rustc's own debuginfo and optimizations to conserve 32-bit memory. -# e.g. https://github.com/rust-lang/rust/issues/45854 %global reduced_debuginfo 0 -%if 0%{?__isa_bits} == 32 -%global reduced_debuginfo 1 -%endif # Also on current riscv64 hardware, although future hardware will be # able to handle it. # e.g. http://fedora.riscv.rocks/koji/buildinfo?buildID=249870 @@ -125,31 +128,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.77.0-unbundle-sqlite.patch - -# Backports of fixes for LLVM 18 compatibility -Patch7: 120529.patch -Patch8: 121088.patch - -# https://github.com/rust-lang/rust/pull/123520 -Patch9: 0001-bootstrap-move-all-of-rustc-s-flags-to-rustc_cargo.patch - -# https://github.com/rust-lang/rust/pull/123652 -Patch10: 0001-Fix-UI-tests-with-dist-vendored-dependencies.patch - -# https://github.com/rust-lang/rust/pull/121179 (partial) -Patch11: 0001-remove-stderr-per-bitwidth-from-some-tests.patch +Patch6: rustc-1.84.0-unbundle-sqlite.patch -# https://github.com/rust-lang/cargo/pull/13744 -Patch12: 0001-test-don-t-compress-test-registry-crates.patch - -# https://github.com/rust-lang/rust-clippy/pull/12682 -Patch13: 0001-The-multiple_unsafe_ops_per_block-test-needs-asm.patch - -# https://github.com/rust-lang/rust/pull/120676 (partial) -Patch14: 0001-Step-all-bootstrap-cfgs-forward.patch - -### RHEL-specific patches below ### +# https://github.com/rust-lang/cc-rs/issues/1354 +Patch7: 0001-Only-translate-profile-flags-for-Clang.patch # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) Source100: macros.rust-toolset @@ -158,19 +140,25 @@ Source102: cargo_vendor.attr Source103: cargo_vendor.prov # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.77.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 == "riscv64" then + arch = "riscv64gc" + end 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()) } %if %defined bootstrap_arches @@ -204,8 +192,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 @@ -219,13 +206,20 @@ BuildRequires: curl-devel BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(liblzma) BuildRequires: pkgconfig(openssl) -BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(zlib) %if %{without bundled_libgit2} 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 + %if %{without disabled_libssh2} BuildRequires: pkgconfig(libssh2) %endif @@ -239,10 +233,9 @@ BuildRequires: ninja-build Provides: bundled(llvm) = %{bundled_llvm_version} %else BuildRequires: cmake >= 3.5.1 -%if %defined llvm +%if %defined llvm_compat_version %global llvm_root %{_libdir}/%{llvm} %else -%global llvm llvm %global llvm_root %{_prefix} %endif BuildRequires: %{llvm}-devel >= %{min_llvm_version} @@ -257,10 +250,20 @@ BuildRequires: procps-ng # debuginfo-gdb tests need gdb BuildRequires: gdb +# Work around https://bugzilla.redhat.com/show_bug.cgi?id=2275274: +# gdb currently prints a "Unable to load 'rpm' module. Please install the python3-rpm package." +# message that breaks version detection. +BuildRequires: python3-rpm # For src/test/run-make/static-pie BuildRequires: glibc-static +# For tests/run-make/pgo-branch-weights +# riscv64 and loongarch64 does not support binutils-gold yet +%ifnarch riscv64 loongarch64 +BuildRequires: binutils-gold +%endif + # Virtual provides for folks who attempt "dnf install rustc" Provides: rustc = %{version}-%{release} @@ -286,6 +289,14 @@ Requires: /usr/bin/cc # support custom-derive plugins like #[proc_macro_derive(Foo)]. %global _find_debuginfo_opts --keep-section .rustc +# The standard library rlibs are essentially static archives, but we don't want +# to strip them because that impairs the debuginfo of all Rust programs. +# It also had a tendency to break the cross-compiled libraries: +# - wasm targets lost the archive index, which we were repairing with llvm-ranlib +# - uefi targets couldn't link builtins like memcpy, possibly due to lost COMDAT flags +%global __brp_strip_static_archive %{nil} +%global __brp_strip_lto %{nil} + %if %{without bundled_llvm} %if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1} %global llvm_has_filecheck 1 @@ -304,15 +315,10 @@ BuildRequires: clang BuildRequires: wasi-libc-static %endif BuildRequires: lld -# brp-strip-static-archive breaks the archive index for wasm -%global __os_install_post \ -%__os_install_post \ -find '%{buildroot}%{rustlibdir}'/wasm*/lib -type f -regex '.*\\.\\(a\\|rlib\\)' -print -exec '%{llvm_root}/bin/llvm-ranlib' '{}' ';' \ -%{nil} %endif # For profiler_builtins -BuildRequires: compiler-rt +BuildRequires: compiler-rt%{?llvm_compat_version} # This component was removed as of Rust 1.69.0. # https://github.com/rust-lang/rust/pull/101841 @@ -352,8 +358,8 @@ BuildArch: noarch %target_description wasm32-unknown-unknown WebAssembly %endif -%if %target_enabled wasm32-wasi -%target_package wasm32-wasi +%if %target_enabled wasm32-wasip1 +%target_package wasm32-wasip1 Requires: lld >= 8.0 %if %with bundled_wasi_libc Provides: bundled(wasi-libc) @@ -361,7 +367,9 @@ Provides: bundled(wasi-libc) Requires: wasi-libc-static %endif BuildArch: noarch -%target_description wasm32-wasi WebAssembly +# 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 %if %target_enabled x86_64-unknown-none @@ -370,12 +378,24 @@ 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 %target_description x86_64-unknown-uefi embedded %endif +%if %target_enabled aarch64-unknown-none-softfloat +%target_package aarch64-unknown-none-softfloat +Requires: lld +%target_description aarch64-unknown-none-softfloat embedded +%endif + %package debugger-common Summary: Common debugger pretty printers for Rust @@ -431,6 +451,9 @@ Summary: Rust's package manager and build tool %if %with bundled_libgit2 Provides: bundled(libgit2) = %{bundled_libgit2_version} %endif +%if %with bundled_sqlite3 +Provides: bundled(sqlite) = %{bundled_sqlite3_version} +%endif # For tests: BuildRequires: git-core # Cargo is not much use without Rust @@ -464,6 +487,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} = %{version}-%{release} + # The standard library sources are needed for most functionality. Recommends: %{name}-src @@ -502,30 +528,30 @@ Recommends: %{name}-std-static = %{version}-%{release} This package includes source files for the Rust standard library. It may be useful as a reference for code completion tools in various editors. - -#%%if 0%{?rhel} - -%package srpm-macros +%package toolset-srpm-macros Summary: RPM macros for building Rust source packages BuildArch: noarch -%description srpm-macros -RPM macros for building source packages for Rust projects. +# This used to be from its own source package, versioned like rust2rpm. +Obsoletes: rust-srpm-macros < 18~ +Provides: rust-srpm-macros = 25.2 +%description toolset-srpm-macros +RPM macros for building source packages for Rust projects. + %package toolset Summary: Rust Toolset BuildArch: noarch Requires: rust = %{version}-%{release} Requires: cargo = %{version}-%{release} - +Requires: rust-toolset-srpm-macros = %{version}-%{release} +Conflicts: cargo-rpm-macros + %description toolset This is the metapackage for Rust Toolset, bringing in the Rust compiler, the Cargo package manager, and a few convenience macros for rpm builds. -#%%endif - - %prep %ifarch %{bootstrap_arches} @@ -554,17 +580,10 @@ rm -rf %{wasi_libc_dir}/dlmalloc/ %if %without bundled_wasi_libc %patch -P5 -p1 %endif +%if %without bundled_sqlite3 %patch -P6 -p1 - -%patch -P7 -p1 -%patch -P8 -p1 -%patch -P9 -p1 -%patch -P10 -p1 -%patch -P11 -p1 -%patch -P12 -p1 -d src/tools/cargo -%patch -P13 -p1 -d src/tools/clippy -%patch -P14 -p1 - +%endif +%patch -P7 -p1 -d vendor/cc-1.2.5 %if %with disabled_libssh2 %patch -P100 -p1 @@ -581,6 +600,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". @@ -589,7 +612,7 @@ mkdir -p src/llvm-project/libunwind/ %clear_dir vendor/*jemalloc-sys*/jemalloc/ %clear_dir vendor/libffi-sys*/libffi/ %clear_dir vendor/libmimalloc-sys*/c_src/mimalloc/ -%clear_dir vendor/libsqlite3-sys*/{sqlite3,sqlcipher}/ +%clear_dir vendor/libsqlite3-sys*/sqlcipher/ %clear_dir vendor/libssh2-sys*/libssh2/ %clear_dir vendor/libz-sys*/src/zlib{,-ng}/ %clear_dir vendor/lzma-sys*/xz-*/ @@ -599,6 +622,14 @@ 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 + %if %with disabled_libssh2 rm -rf vendor/libssh2-sys*/ %endif @@ -631,8 +662,9 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' # These are similar to __cflags_arch_* in /usr/lib/rpm/redhat/macros %global rustc_target_cpus %{lua: do + local anolis = tonumber(rpm.expand("0%{?anolis}")) local env = - " RUSTC_TARGET_CPU_X86_64=x86-64" .. "" + " RUSTC_TARGET_CPU_X86_64=x86-64" .. ((anolis) and "-v2" or "") print(env) end} @@ -641,7 +673,8 @@ end} %global rust_env %{shrink: %{?rustflags:RUSTFLAGS="%{rustflags}"} %{rustc_target_cpus} - LIBSQLITE3_SYS_USE_PKG_CONFIG=1 + %{!?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} } %global export_rust_env export %{rust_env} @@ -650,35 +683,50 @@ 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 wasm_targets %if %with bundled_wasi_libc -%make_build --quiet -C %{wasi_libc_dir} MALLOC_IMPL=emmalloc CC=clang AR=llvm-ar NM=llvm-nm -%define wasm_target_config --set target.wasm32-wasi.wasi-root=%{wasi_libc_dir}/sysroot +%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-wasip1 +%define wasm_target_config %{shrink: + --set target.wasm32-wasip1.wasi-root=%{wasi_libc_dir}/sysroot +} %else %define wasm_target_config %{shrink: - --set target.wasm32-wasi.wasi-root=%{_prefix}/wasm32-wasi - --set target.wasm32-wasi.self-contained=false + --set target.wasm32-wasip1.wasi-root=%{_prefix}/wasm32-wasi + --set target.wasm32-wasip1.self-contained=false } %endif %endif # Find the compiler-rt library for the Rust profiler_builtins crate. -%if 0%{?clang_major_version} >= 17 -%define profiler %{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a +%if %defined llvm_compat_version +# clang_resource_dir is not defined for compat builds. +%define profiler /usr/lib/clang/%{llvm_compat_version}/lib/%{_arch}-anolis-linux-gnu/libclang_rt.profile.a %else -# The exact profiler path is version dependent.. -%define profiler %(echo %{_libdir}/clang/??/lib/libclang_rt.profile-*.a) +%define profiler %{clang_resource_dir}/lib/%{_arch}-anolis-linux-gnu/libclang_rt.profile.a %endif test -r "%{profiler}" %configure --disable-option-checking \ + --docdir=%{_pkgdocdir} \ --libdir=%{common_libdir} \ --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ --set target.%{rust_triple}.linker=%{__cc} \ @@ -695,57 +743,61 @@ 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 \ --enable-verbose-tests \ - --dist-compression-formats=gz \ --release-channel=%{channel} \ - --release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}" + --release-description="%{?anolis:Anolis OS }%{version}-%{release}" %global __x %{__python3} ./x.py -%global __xk %{__x} --keep-stage=0 --keep-stage=1 %if %with rustc_pgo # Build the compiler with profile instrumentation -PROFRAW="$PWD/build/profiles" -PROFDATA="$PWD/build/rustc.profdata" -mkdir -p "$PROFRAW" -%{__x} build -j "$ncpus" sysroot --rust-profile-generate="$PROFRAW" +%define profraw $PWD/build/profiles +%define profdata $PWD/build/rustc.profdata +mkdir -p "%{profraw}" +%{__x} build sysroot --rust-profile-generate="%{profraw}" # Build cargo as a workload to generate compiler profiles -env LLVM_PROFILE_FILE="$PROFRAW/default_%%m_%%p.profraw" %{__xk} build cargo -llvm-profdata merge -o "$PROFDATA" "$PROFRAW" -rm -r "$PROFRAW" build/%{rust_triple}/stage2*/ -# Rebuild the compiler using the profile data -%{__x} build -j "$ncpus" sysroot --rust-profile-use="$PROFDATA" -%else -# Build the compiler without PGO -%{__x} build -j "$ncpus" sysroot +env LLVM_PROFILE_FILE="%{profraw}/default_%%m_%%p.profraw" \ + %{__x} --keep-stage=0 --keep-stage=1 build cargo +# Finalize the profile data and clean up the raw files +%{llvm_root}/bin/llvm-profdata merge -o "%{profdata}" "%{profraw}" +rm -r "%{profraw}" build/%{rust_triple}/stage2*/ +# Redefine the macro to use that profile data from now on +%global __x %{__x} --rust-profile-use="%{profdata}" %endif +# Build the compiler normally (with or without PGO) +%{__x} build sysroot + # Build everything else normally -%{__xk} build -%{__xk} doc +%{__x} build +%{__x} doc for triple in %{?all_targets} ; do - %{__xk} build --target=$triple std + %{__x} build --target=$triple std done %install %{export_rust_env} -DESTDIR=%{buildroot} %{__xk} install +DESTDIR=%{buildroot} %{__x} install for triple in %{?all_targets} ; do - DESTDIR=%{buildroot} %{__xk} install --target=$triple std + DESTDIR=%{buildroot} %{__x} install --target=$triple std done # The rls stub doesn't have an install target, but we can just copy it. @@ -757,7 +809,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' \ @@ -768,18 +820,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 '{}' '+' @@ -791,21 +837,18 @@ find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+' # We don't actually need to ship any of those python scripts in rust-src anyway. find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+' -# FIXME: __os_install_post will strip the rlibs -# -- should we find a way to preserve debuginfo? - # Remove unwanted documentation files (we already package them) -rm -f %{buildroot}%{_docdir}/%{name}/README.md -rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT -rm -f %{buildroot}%{_docdir}/%{name}/LICENSE -rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE -rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT -rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY -rm -f %{buildroot}%{_docdir}/%{name}/*.old +rm -f %{buildroot}%{_pkgdocdir}/README.md +rm -f %{buildroot}%{_pkgdocdir}/COPYRIGHT +rm -f %{buildroot}%{_pkgdocdir}/LICENSE +rm -f %{buildroot}%{_pkgdocdir}/LICENSE-APACHE +rm -f %{buildroot}%{_pkgdocdir}/LICENSE-MIT +rm -f %{buildroot}%{_pkgdocdir}/LICENSE-THIRD-PARTY +rm -f %{buildroot}%{_pkgdocdir}/*.old # Sanitize the HTML documentation -find %{buildroot}%{_docdir}/%{name}/html -empty -delete -find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+' +find %{buildroot}%{_pkgdocdir}/html -empty -delete +find %{buildroot}%{_pkgdocdir}/html -type f -exec chmod -x '{}' '+' # Create the path for crate-devel packages mkdir -p %{buildroot}%{_datadir}/cargo/registry @@ -818,14 +861,10 @@ ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html # We don't want Rust copies of LLVM tools (rust-lld, rust-llvm-dwp) rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* -#%%if 0%{?rhel} -# This allows users to build packages using Rust Toolset. %{__install} -D -m 644 %{S:100} %{buildroot}%{rpmmacrodir}/macros.rust-toolset %{__install} -D -m 644 %{S:101} %{buildroot}%{rpmmacrodir}/macros.rust-srpm %{__install} -D -m 644 %{S:102} %{buildroot}%{_fileattrsdir}/cargo_vendor.attr %{__install} -D -m 755 %{S:103} %{buildroot}%{_rpmconfigdir}/cargo_vendor.prov -#%%endif - %check %{export_rust_env} @@ -853,19 +892,26 @@ 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. -%{__xk} 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/" -%{__xk} test --no-fail-fast cargo || : +%ifarch aarch64 +# https://github.com/rust-lang/rust/issues/123733 +%define cargo_test_skip --test-args "--skip panic_abort_doc_tests" +%endif +%{__x} test --no-fail-fast cargo %{?cargo_test_skip} || : rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" -%{__xk} test --no-fail-fast clippy || : +%{__x} test --no-fail-fast clippy || : -%{__xk} test --no-fail-fast rust-analyzer || : +%{__x} test --no-fail-fast rust-analyzer || : -%{__xk} test --no-fail-fast rustfmt || : +%{__x} test --no-fail-fast rustfmt || : %ldconfig_scriptlets @@ -876,14 +922,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 @@ -891,6 +933,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 \ @@ -917,12 +960,12 @@ 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 %target_enabled wasm32-wasip1 +%target_files wasm32-wasip1 %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 +%dir %{rustlibdir}/wasm32-wasip1/lib/self-contained +%{rustlibdir}/wasm32-wasip1/lib/self-contained/crt*.o +%{rustlibdir}/wasm32-wasip1/lib/self-contained/libc.a %endif %endif @@ -930,10 +973,18 @@ 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 +%if %target_enabled aarch64-unknown-none-softfloat +%target_files aarch64-unknown-none-softfloat +%endif + %files debugger-common %dir %{rustlibdir} @@ -953,9 +1004,9 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %files doc -%docdir %{_docdir}/%{name} -%dir %{_docdir}/%{name} -%{_docdir}/%{name}/html +%docdir %{_pkgdocdir} +%dir %{_pkgdocdir} +%{_pkgdocdir}/html # former cargo-doc %docdir %{_docdir}/cargo %dir %{_docdir}/cargo @@ -999,18 +1050,18 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %{rustlibdir}/src -#%%if 0%{?rhel} -%files srpm-macros -%{rpmmacrodir}/macros.rust-srpm +%files toolset-srpm-macros +%{rpmmacrodir}/macros.rust-srpm %files toolset %{rpmmacrodir}/macros.rust-toolset %{_fileattrsdir}/cargo_vendor.attr %{_rpmconfigdir}/cargo_vendor.prov -#%%endif - %changelog +* Fri Feb 21 2025 Chang Gao - 1.84.1-1 +- Update to 1.84.1 + * Thu May 30 2024 gaoxulin - 1.77.2-1 - Update to 1.77.2 to fix CVE-2024-24576 diff --git a/rustc-1.77.0-disable-libssh2.patch b/rustc-1.84.0-disable-libssh2.patch similarity index 43% rename from rustc-1.77.0-disable-libssh2.patch rename to rustc-1.84.0-disable-libssh2.patch index 859fecb7018c134dca64ce1bb18123ca4f061ce2..267bc3ca4f677e61e32f0ebe96a888857239ce47 100644 --- a/rustc-1.77.0-disable-libssh2.patch +++ b/rustc-1.84.0-disable-libssh2.patch @@ -1,7 +1,7 @@ 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-02-14 14:06:05.881165093 +0100 -+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-02-14 14:06:27.169456166 +0100 -@@ -2072,7 +2072,6 @@ checksum = "ee4126d8b4ee5c9d9ea891dd875c +--- 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", @@ -9,7 +9,7 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools "libz-sys", "openssl-sys", "pkg-config", -@@ -2113,20 +2112,6 @@ dependencies = [ +@@ -2313,20 +2312,6 @@ dependencies = [ "pkg-config", "vcpkg", ] @@ -31,14 +31,14 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools [[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-02-14 14:06:10.400226884 +0100 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-02-14 14:06:51.225785086 +0100 -@@ -44,7 +44,7 @@ curl = "0.4.44" - curl-sys = "0.4.70" +--- 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.28", default-features = false, features = ["zlib"] } --git2 = "0.18.2" -+git2 = { version = "0.18.2", default-features = false, features = ["https"] } - git2-curl = "0.19.0" - gix = { version = "0.57.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision"] } - gix-features-for-configuration-only = { version = "0.37.1", package = "gix-features", features = [ "parallel" ] } + 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/rustc-1.77.0-unbundle-sqlite.patch b/rustc-1.84.0-unbundle-sqlite.patch similarity index 31% rename from rustc-1.77.0-unbundle-sqlite.patch rename to rustc-1.84.0-unbundle-sqlite.patch index 50aa4a817680901ddb22013925fdf3b74de4c0a7..2e3ecc346471a91ccc5531038cabcffa1e2b5d42 100644 --- a/rustc-1.77.0-unbundle-sqlite.patch +++ b/rustc-1.84.0-unbundle-sqlite.patch @@ -1,23 +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-02-14 13:00:20.318976752 +0100 -+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-02-14 13:00:28.447051475 +0100 -@@ -2110,7 +2110,6 @@ version = "0.27.0" +--- 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 = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" + 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-02-14 13:00:14.942927327 +0100 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-02-14 13:00:40.688164017 +0100 -@@ -77,7 +77,7 @@ proptest = "1.4.0" - pulldown-cmark = { version = "0.9.3", default-features = false } +--- 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.2" --rusqlite = { version = "0.30.0", features = ["bundled"] } -+rusqlite = { version = "0.30.0", features = [] } - rustfix = { version = "0.8.0", path = "crates/rustfix" } + 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" - security-framework = "2.9.2" diff --git a/rustc-1.77.2-src.tar.xz b/rustc-1.84.1-src.tar.xz similarity index 45% rename from rustc-1.77.2-src.tar.xz rename to rustc-1.84.1-src.tar.xz index ed7d5176f3ff1514be8dd2c2c46c4a81bd073645..02dca9a65e409d862f64620bd241a7fbd19151ce 100644 Binary files a/rustc-1.77.2-src.tar.xz and b/rustc-1.84.1-src.tar.xz differ diff --git a/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz b/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz deleted file mode 100644 index e3fea7b83a2726cf7707f95b276f65cd6b12b371..0000000000000000000000000000000000000000 Binary files a/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz and /dev/null differ diff --git a/wasi-libc-wasi-sdk-25.tar.gz b/wasi-libc-wasi-sdk-25.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..ed82c300d13dae61ac29e8f78958a520177391ce Binary files /dev/null and b/wasi-libc-wasi-sdk-25.tar.gz differ