From 5e1761e1ba57ac09582bcf3544c20db84d9ef8ed Mon Sep 17 00:00:00 2001 From: tranzystorekk Date: Thu, 26 Jun 2025 23:04:56 +0200 Subject: [PATCH] rust: update to 1.88.0 --- ...dlib-and-musl_root-from-musl-targets.patch | 173 ++++++++++-------- ...kage-of-musl-libc-for-the-libc-crate.patch | 25 --- srcpkgs/rust/patches/0015-downgrade-cc.patch | 24 +++ srcpkgs/rust/template | 17 +- 4 files changed, 127 insertions(+), 112 deletions(-) delete mode 100644 srcpkgs/rust/patches/0010-Fix-dynamic-linkage-of-musl-libc-for-the-libc-crate.patch create mode 100644 srcpkgs/rust/patches/0015-downgrade-cc.patch diff --git a/srcpkgs/rust/patches/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch b/srcpkgs/rust/patches/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch index 9403f3282d4..5d5e334957f 100644 --- a/srcpkgs/rust/patches/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch +++ b/srcpkgs/rust/patches/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch @@ -5,23 +5,41 @@ Subject: [PATCH 02/15] Remove -nostdlib and musl_root from musl targets extended by various void contributors to match our musl setup +diff --git a/bootstrap.example.toml b/bootstrap.example.toml +index 1371fd644..dfd7e17fd 100644 +--- a/bootstrap.example.toml ++++ b/bootstrap.example.toml +@@ -658,14 +658,6 @@ + # If using tarball sources, default value is "auto-detect", otherwise, it's "dev". + #channel = if "is a tarball source" { "auto-detect" } else { "dev" } + +-# The root location of the musl installation directory. The library directory +-# will also need to contain libunwind.a for an unwinding implementation. Note +-# that this option only makes sense for musl targets that produce statically +-# linked binaries. +-# +-# Defaults to /usr on musl hosts. Has no default otherwise. +-#musl-root = (path) +- + # By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix + # platforms to ensure that the compiler is usable by default from the build + # directory (as it links to a number of dynamic libraries). This may not be diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs -index 1a854fe36..7b0cc7b55 100644 +index 1bef60240..f81dbfa0e 100644 --- a/compiler/rustc_target/src/spec/base/linux_musl.rs +++ b/compiler/rustc_target/src/spec/base/linux_musl.rs -@@ -1,12 +1,9 @@ +@@ -1,11 +1,8 @@ -use crate::spec::{LinkSelfContainedDefault, TargetOptions, base, crt_objects}; +use crate::spec::{base, TargetOptions}; pub(crate) fn opts() -> TargetOptions { - let mut base = base::linux::opts(); - - base.env = "musl".into(); -- base.pre_link_objects_self_contained = crt_objects::pre_musl_self_contained(); -- base.post_link_objects_self_contained = crt_objects::post_musl_self_contained(); -- base.link_self_contained = LinkSelfContainedDefault::InferredForMusl; - - base + TargetOptions { + env: "musl".into(), +- pre_link_objects_self_contained: crt_objects::pre_musl_self_contained(), +- post_link_objects_self_contained: crt_objects::post_musl_self_contained(), +- link_self_contained: LinkSelfContainedDefault::InferredForMusl, + ..base::linux::opts() + } } diff --git a/compiler/rustc_target/src/spec/crt_objects.rs b/compiler/rustc_target/src/spec/crt_objects.rs index e3b6430a4..13a96e2cb 100644 @@ -57,7 +75,7 @@ index e3b6430a4..13a96e2cb 100644 new(&[ (LinkOutputKind::DynamicNoPicExe, &["crt2.o", "rsbegin.o"]), diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs -index 4fefdfa5c..bb65048a5 100644 +index 58ba06e12..da6487ae6 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs @@ -12,9 +12,6 @@ pub(crate) fn target() -> Target { @@ -69,9 +87,9 @@ index 4fefdfa5c..bb65048a5 100644 - Target { llvm_target: "aarch64-unknown-linux-musl".into(), - metadata: crate::spec::TargetMetadata { + metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs -index 4bbde7667..50f1a8d88 100644 +index ca52e5b3c..1012b5b1a 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -20,8 +20,6 @@ pub(crate) fn target() -> Target { @@ -84,7 +102,7 @@ index 4bbde7667..50f1a8d88 100644 }, } diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs -index 22e49f2f1..28a954758 100644 +index a3ac0223c..ec43eebfc 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -23,8 +23,6 @@ pub(crate) fn target() -> Target { @@ -97,10 +115,10 @@ index 22e49f2f1..28a954758 100644 }, } diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs -index 3d25c951e..f509c9825 100644 +index 47a7eb3d5..da1026485 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs -@@ -9,8 +9,6 @@ pub(crate) fn target() -> Target { +@@ -11,8 +11,6 @@ pub(crate) fn target() -> Target { base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]); base.stack_probes = StackProbeType::Inline; @@ -110,10 +128,10 @@ index 3d25c951e..f509c9825 100644 // The unwinder used by i686-unknown-linux-musl, the LLVM libunwind // implementation, apparently relies on frame pointers existing... somehow. diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs -index 8dcdc5be8..8be0f335d 100644 +index cc5f88862..0203c776a 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs -@@ -14,8 +14,6 @@ pub(crate) fn target() -> Target { +@@ -16,8 +16,6 @@ pub(crate) fn target() -> Target { | SanitizerSet::MEMORY | SanitizerSet::THREAD; base.supports_xray = true; @@ -122,27 +140,8 @@ index 8dcdc5be8..8be0f335d 100644 Target { llvm_target: "x86_64-unknown-linux-musl".into(), -diff --git a/config.example.toml b/config.example.toml -index f5395375a..3aa6e21ac 100644 ---- a/config.example.toml -+++ b/config.example.toml -@@ -625,14 +625,6 @@ - # behavior -- this may lead to miscompilations or other bugs. - #description = "" - --# The root location of the musl installation directory. The library directory --# will also need to contain libunwind.a for an unwinding implementation. Note --# that this option only makes sense for musl targets that produce statically --# linked binaries. --# --# Defaults to /usr on musl hosts. Has no default otherwise. --#musl-root = (path) -- - # By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix - # platforms to ensure that the compiler is usable by default from the build - # directory (as it links to a number of dynamic libraries). This may not be diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py -index ac971a64d..f7367c8da 100755 +index 0d4d6e0ff..0f5a6d1c1 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -179,76 +179,6 @@ v("llvm-config", None, "set path to llvm-config") @@ -220,13 +219,13 @@ index ac971a64d..f7367c8da 100755 - "mips64el-unknown-linux-muslabi64 install directory", -) v( - "musl-root-powerpc64le", - "target.powerpc64le-unknown-linux-musl.musl-root", + "musl-root-powerpc64", + "target.powerpc64-unknown-linux-musl.musl-root", diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs -index 479327d63..115b3eb0a 100644 +index 2e5865e50..b9cc1ad1e 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs -@@ -333,39 +333,7 @@ fn copy_self_contained_objects( +@@ -372,53 +372,7 @@ fn copy_self_contained_objects( let mut target_deps = vec![]; // Copies the libc and CRT objects. @@ -240,24 +239,38 @@ index 479327d63..115b3eb0a 100644 - let srcdir = builder.musl_libdir(target).unwrap_or_else(|| { - panic!("Target {:?} does not have a \"musl-libdir\" key", target.triple) - }); -- for &obj in &["libc.a", "crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] { -- copy_and_stamp( -- builder, -- &libdir_self_contained, -- &srcdir, -- obj, -- &mut target_deps, -- DependencyType::TargetSelfContained, -- ); +- if !target.starts_with("wasm32") { +- for &obj in &["libc.a", "crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] { +- copy_and_stamp( +- builder, +- &libdir_self_contained, +- &srcdir, +- obj, +- &mut target_deps, +- DependencyType::TargetSelfContained, +- ); +- } +- let crt_path = builder.ensure(llvm::CrtBeginEnd { target }); +- for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] { +- let src = crt_path.join(obj); +- let target = libdir_self_contained.join(obj); +- builder.copy_link(&src, &target, FileType::NativeLibrary); +- target_deps.push((target, DependencyType::TargetSelfContained)); +- } +- } else { +- // For wasm32 targets, we need to copy the libc.a and crt1-command.o files from the +- // musl-libdir, but we don't need the other files. +- for &obj in &["libc.a", "crt1-command.o"] { +- copy_and_stamp( +- builder, +- &libdir_self_contained, +- &srcdir, +- obj, +- &mut target_deps, +- DependencyType::TargetSelfContained, +- ); +- } - } -- let crt_path = builder.ensure(llvm::CrtBeginEnd { target }); -- for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] { -- let src = crt_path.join(obj); -- let target = libdir_self_contained.join(obj); -- builder.copy_link(&src, &target); -- target_deps.push((target, DependencyType::TargetSelfContained)); -- } -- - if !target.starts_with("s390x") { - let libunwind_path = copy_llvm_libunwind(builder, target, &libdir_self_contained); - target_deps.push((libunwind_path, DependencyType::TargetSelfContained)); @@ -266,8 +279,8 @@ index 479327d63..115b3eb0a 100644 + if target.contains("-wasi") { let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| { panic!( - "Target {:?} does not have a \"wasi-root\" key in Config.toml \ -@@ -573,15 +541,6 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car + "Target {:?} does not have a \"wasi-root\" key in bootstrap.toml \ +@@ -626,15 +580,6 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car .arg("--manifest-path") .arg(builder.src.join("library/sysroot/Cargo.toml")); @@ -284,10 +297,10 @@ index 479327d63..115b3eb0a 100644 if let Some(dir) = builder.wasi_libdir(target) { let root = format!("native={}", dir.to_str().unwrap()); diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs -index 65f286a05..f12d57b14 100644 +index 65a3e7667..2a6a22fbb 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs -@@ -350,7 +350,6 @@ pub struct Config { +@@ -372,7 +372,6 @@ pub struct Config { pub print_step_rusage: bool, // Fallback musl-root for all targets @@ -295,7 +308,7 @@ index 65f286a05..f12d57b14 100644 pub prefix: Option, pub sysconfdir: Option, pub datadir: Option, -@@ -635,8 +634,6 @@ pub struct Target { +@@ -665,8 +664,6 @@ pub struct Target { pub profiler: Option, pub rpath: Option, pub crt_static: Option, @@ -304,15 +317,15 @@ index 65f286a05..f12d57b14 100644 pub wasi_root: Option, pub qemu_rootfs: Option, pub runner: Option, -@@ -1171,7 +1168,6 @@ define_config! { - default_linker: Option = "default-linker", +@@ -1296,7 +1293,6 @@ define_config! { channel: Option = "channel", + // FIXME: Remove this field at Q2 2025, it has been replaced by build.description description: Option = "description", - musl_root: Option = "musl-root", rpath: Option = "rpath", strip: Option = "strip", frame_pointers: Option = "frame-pointers", -@@ -1226,8 +1222,6 @@ define_config! { +@@ -1351,8 +1347,6 @@ define_config! { profiler: Option = "profiler", rpath: Option = "rpath", crt_static: Option = "crt-static", @@ -321,15 +334,15 @@ index 65f286a05..f12d57b14 100644 wasi_root: Option = "wasi-root", qemu_rootfs: Option = "qemu-rootfs", no_std: Option = "no-std", -@@ -1821,7 +1815,6 @@ impl Config { +@@ -2018,7 +2012,6 @@ impl Config { default_linker, channel: _, // already handled above - description, + description: rust_description, - musl_root, rpath, verbose_tests, optimize_tests, -@@ -1929,7 +1922,6 @@ impl Config { +@@ -2132,7 +2125,6 @@ impl Config { config.llvm_enzyme = llvm_enzyme.unwrap_or(config.channel == "dev" || config.channel == "nightly"); config.rustc_default_linker = default_linker; @@ -337,7 +350,7 @@ index 65f286a05..f12d57b14 100644 config.save_toolstates = save_toolstates.map(PathBuf::from); set( &mut config.deny_warnings, -@@ -2152,8 +2144,6 @@ impl Config { +@@ -2364,8 +2356,6 @@ impl Config { target.ranlib = cfg.ranlib.map(PathBuf::from); target.linker = cfg.linker.map(PathBuf::from); target.crt_static = cfg.crt_static; @@ -346,7 +359,7 @@ index 65f286a05..f12d57b14 100644 target.wasi_root = cfg.wasi_root.map(PathBuf::from); target.qemu_rootfs = cfg.qemu_rootfs.map(PathBuf::from); target.runner = cfg.runner; -@@ -3295,7 +3285,6 @@ fn check_incompatible_options_for_ci_rustc( +@@ -3583,7 +3573,6 @@ fn check_incompatible_options_for_ci_rustc( debuginfo_level_tools: _, debuginfo_level_tests: _, backtrace: _, @@ -355,7 +368,7 @@ index 65f286a05..f12d57b14 100644 optimize_tests: _, codegen_tests: _, diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs -index 9e4a0816e..36c3b5901 100644 +index eb0bf1d16..b85cfedd6 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -11,7 +11,7 @@ @@ -367,7 +380,7 @@ index 9e4a0816e..36c3b5901 100644 use crate::Build; #[cfg(not(test))] -@@ -325,28 +325,6 @@ than building it. +@@ -322,28 +322,6 @@ than building it. continue; } @@ -375,7 +388,7 @@ index 9e4a0816e..36c3b5901 100644 - if target.contains("musl") && !target.contains("unikraft") { - // If this is a native target (host is also musl) and no musl-root is given, - // fall back to the system toolchain in /usr before giving up -- if build.musl_root(*target).is_none() && build.is_builder_target(target) { +- if build.musl_root(*target).is_none() && build.config.is_host_target(*target) { - let target = build.config.target_config.entry(*target).or_default(); - target.musl_root = Some("/usr".into()); - } @@ -388,7 +401,7 @@ index 9e4a0816e..36c3b5901 100644 - None => panic!( - "when targeting MUSL either the rust.musl-root \ - option or the target.$TARGET.musl-root option must \ -- be specified in config.toml" +- be specified in bootstrap.toml" - ), - } - } @@ -397,10 +410,10 @@ index 9e4a0816e..36c3b5901 100644 // There are three builds of cmake on windows: MSVC, MinGW, and // Cygwin. The Cygwin build does not have generators for Visual diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs -index 21b02a3b5..491d924d4 100644 +index 1e6acad5c..923904111 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs -@@ -1322,25 +1322,6 @@ Executed at: {executed_at}"#, +@@ -1360,25 +1360,6 @@ Executed at: {executed_at}"#, } } @@ -427,10 +440,10 @@ index 21b02a3b5..491d924d4 100644 /// configured. /// diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs -index 45797c127..12393b659 100644 +index ceac24d43..49bcb7b3a 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs -@@ -210,30 +210,6 @@ fn default_compiler( +@@ -226,30 +226,6 @@ fn default_compiler( } } diff --git a/srcpkgs/rust/patches/0010-Fix-dynamic-linkage-of-musl-libc-for-the-libc-crate.patch b/srcpkgs/rust/patches/0010-Fix-dynamic-linkage-of-musl-libc-for-the-libc-crate.patch deleted file mode 100644 index 7c388295099..00000000000 --- a/srcpkgs/rust/patches/0010-Fix-dynamic-linkage-of-musl-libc-for-the-libc-crate.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 7e100ca9dad23efa1aafccd8faf86ec5fa85c351 Mon Sep 17 00:00:00 2001 -From: q66 -Date: Sun, 3 May 2020 18:02:03 +0200 -Subject: [PATCH 10/15] Fix dynamic linkage of musl libc for the libc crate - -diff --git a/vendor/libc-0.2.169/src/unix/mod.rs b/vendor/libc-0.2.169/src/unix/mod.rs -index a14dafdf0..6aabd6765 100644 ---- a/vendor/libc-0.2.169/src/unix/mod.rs -+++ b/vendor/libc-0.2.169/src/unix/mod.rs -@@ -444,7 +444,14 @@ cfg_if! { - #[link(name = "dl", cfg(not(target_feature = "crt-static")))] - #[link(name = "c", cfg(not(target_feature = "crt-static")))] - extern "C" {} -- } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] { -+ } else if #[cfg(target_env = "musl")] { -+ #[link(name = "c")] -+ extern {} -+ #[cfg_attr(feature = "rustc-dep-of-std", -+ link(name = "gcc", kind = "static", modifiers = "-bundle", -+ cfg(target_feature = "crt-static")))] -+ extern {} -+ } else if #[cfg(target_env = "ohos")] { - #[cfg_attr( - feature = "rustc-dep-of-std", - link( diff --git a/srcpkgs/rust/patches/0015-downgrade-cc.patch b/srcpkgs/rust/patches/0015-downgrade-cc.patch new file mode 100644 index 00000000000..ed569508bfd --- /dev/null +++ b/srcpkgs/rust/patches/0015-downgrade-cc.patch @@ -0,0 +1,24 @@ +diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml +index 97eebffd1..90960aad9 100644 +--- a/compiler/rustc_codegen_ssa/Cargo.toml ++++ b/compiler/rustc_codegen_ssa/Cargo.toml +@@ -11,7 +11,7 @@ bitflags = "2.4.1" + bstr = "1.11.3" + # Pinned so `cargo update` bumps don't cause breakage. Please also update the + # `cc` in `rustc_llvm` if you update the `cc` here. +-cc = "=1.2.16" ++cc = "=1.2.14" + either = "1.5.0" + itertools = "0.12" + pathdiff = "0.2.0" +diff --git a/compiler/rustc_llvm/Cargo.toml b/compiler/rustc_llvm/Cargo.toml +index 061562b2e..beda6ffe1 100644 +--- a/compiler/rustc_llvm/Cargo.toml ++++ b/compiler/rustc_llvm/Cargo.toml +@@ -12,5 +12,5 @@ libc = "0.2.73" + # tidy-alphabetical-start + # Pinned so `cargo update` bumps don't cause breakage. Please also update the + # pinned `cc` in `rustc_codegen_ssa` if you update `cc` here. +-cc = "=1.2.16" ++cc = "=1.2.14" + # tidy-alphabetical-end diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template index 6215932ea42..ed086aa2707 100644 --- a/srcpkgs/rust/template +++ b/srcpkgs/rust/template @@ -8,7 +8,7 @@ # uploaded to https://repo-default.voidlinux.org/distfiles/ # pkgname=rust -version=1.86.0 +version=1.88.0 revision=1 _llvmver=19 hostmakedepends="curl pkg-config python3 tar cargo-bootstrap" @@ -19,7 +19,7 @@ maintainer="Enno Boland " license="Apache-2.0 OR MIT" homepage="https://www.rust-lang.org/" distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz" -checksum=022a27286df67900a044d227d9db69d4732ec3d833e4ffc259c4425ed71eed80 +checksum=3a97544434848ae3d193d1d6bc83d6f24cb85c261ad95f955fde47ec64cfcfbe lib32disabled=yes make_check=no # CBA for now python_version=3 # needed for python files in rust-src @@ -58,11 +58,14 @@ post_patch() { done fi - # clear out all the checksum nonsense of patched vendor crates - _clear_vendor_checksums libc-0.2.169 + # ensure no leftover vendor config remains + rm -r .cargo - # pre-configure 01-override-config overwrites vendor files - _clear_vendor_checksums onig_sys-69.8.1 + cargo update --package cc@1.2.16 --precise 1.2.14 + ( + cd src/tools/rustbook + cargo update --package cc@1.2.21 --precise 1.2.14 + ) } do_configure() { @@ -110,7 +113,7 @@ do_configure() { --target="${RUST_TARGET}" \ --prefix=/usr \ --python=python3 \ - --enable-vendor \ + --disable-vendor \ --enable-locked-deps \ --enable-verbose-tests \ --disable-full-bootstrap \