From 083dfbedd2a74ae6b20b35862dac993cac68d790 Mon Sep 17 00:00:00 2001 From: he Date: Sun, 3 Mar 2024 14:53:32 +0000 Subject: [PATCH] rust: Upgrade to version 1.75.0. Pkgsrc changes: * Adjust patches and cargo checksums to new versions. * For an external LLVM, set dependency of llvm >= 16, in accordance with the upstream changes. * Mark that on NetBSD we now need >= 9.0, so 8.x is no longer supported. * On NetBSD/sparc64 10.x, we now need GCC 12 to build the embedded LLVM, which is version 17; apparently GCC 10.4 or 10.5 mis-compiles it, resulting in an illegal instruction fault during the build. Ref. https://github.com/rust-lang/rust/issues/117231 Upstream changes: Version 1.75.0 (2023-12-28) ========================== - [Stabilize `async fn` and return-position `impl Trait` in traits.] (https://github.com/rust-lang/rust/pull/115822/) - [Allow function pointer signatures containing `&mut T` in `const` contexts.] (https://github.com/rust-lang/rust/pull/116015/) - [Match `usize`/`isize` exhaustively with half-open ranges.] (https://github.com/rust-lang/rust/pull/116692/) - [Guarantee that `char` has the same size and alignment as `u32`.] (https://github.com/rust-lang/rust/pull/116894/) - [Document that the null pointer has the 0 address.] (https://github.com/rust-lang/rust/pull/116988/) - [Allow partially moved values in `match`.] (https://github.com/rust-lang/rust/pull/103208/) - [Add notes about non-compliant FP behavior on 32bit x86 targets.] (https://github.com/rust-lang/rust/pull/113053/) - [Stabilize ratified RISC-V target features.] (https://github.com/rust-lang/rust/pull/116485/) Compiler -------- - [Rework negative coherence to properly consider impls that only partly overlap.] (https://github.com/rust-lang/rust/pull/112875/) - [Bump `COINDUCTIVE_OVERLAP_IN_COHERENCE` to deny, and warn in dependencies.] (https://github.com/rust-lang/rust/pull/116493/) - [Consider alias bounds when computing liveness in NLL.] (https://github.com/rust-lang/rust/pull/116733/) - [Add the V (vector) extension to the `riscv64-linux-android` target spec.] (https://github.com/rust-lang/rust/pull/116618/) - [Automatically enable cross-crate inlining for small functions] (https://github.com/rust-lang/rust/pull/116505) - Add several new tier 3 targets: - [`csky-unknown-linux-gnuabiv2hf`] (https://github.com/rust-lang/rust/pull/117049/) - [`i586-unknown-netbsd`] (https://github.com/rust-lang/rust/pull/117170/) - [`mipsel-unknown-netbsd`] (https://github.com/rust-lang/rust/pull/117356/) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. Libraries --------- - [Override `Waker::clone_from` to avoid cloning `Waker`s unnecessarily.] (https://github.com/rust-lang/rust/pull/96979/) - [Implement `BufRead` for `VecDeque`.] (https://github.com/rust-lang/rust/pull/110604/) - [Implement `FusedIterator` for `DecodeUtf16` when the inner iterator does.] (https://github.com/rust-lang/rust/pull/110729/) - [Implement `Not, Bit{And,Or}{,Assign}` for IP addresses.] (https://github.com/rust-lang/rust/pull/113747/) - [Implement `Default` for `ExitCode`.] (https://github.com/rust-lang/rust/pull/114589/) - [Guarantee representation of None in NPO] (https://github.com/rust-lang/rust/pull/115333/) - [Document when atomic loads are guaranteed read-only.] (https://github.com/rust-lang/rust/pull/115577/) - [Broaden the consequences of recursive TLS initialization.] (https://github.com/rust-lang/rust/pull/116172/) - [Windows: Support sub-millisecond sleep.] (https://github.com/rust-lang/rust/pull/116461/) - [Fix generic bound of `str::SplitInclusive`'s `DoubleEndedIterator` impl] (https://github.com/rust-lang/rust/pull/100806/) - [Fix exit status / wait status on non-Unix `cfg(unix)` platforms.] (https://github.com/rust-lang/rust/pull/115108/) Stabilized APIs --------------- - [`Atomic*::from_ptr`] (https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.from_ptr) - [`FileTimes`] (https://doc.rust-lang.org/stable/std/fs/struct.FileTimes.html) - [`FileTimesExt`] (https://doc.rust-lang.org/stable/std/os/windows/fs/trait.FileTimesExt.html) - [`File::set_modified`] (https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.set_modified) - [`File::set_times`] (https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.set_times) - [`IpAddr::to_canonical`] (https://doc.rust-lang.org/stable/core/net/enum.IpAddr.html#method.to_canonical) - [`Ipv6Addr::to_canonical`] (https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.to_canonical) - [`Option::as_slice`] (https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_slice) - [`Option::as_mut_slice`] (https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_mut_slice) - [`pointer::byte_add`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_add) - [`pointer::byte_offset`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_offset) - [`pointer::byte_offset_from`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_offset_from) - [`pointer::byte_sub`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_sub) - [`pointer::wrapping_byte_add`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_add) - [`pointer::wrapping_byte_offset`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_offset) - [`pointer::wrapping_byte_sub`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_sub) These APIs are now stable in const contexts: - [`Ipv6Addr::to_ipv4_mapped`] (https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.to_ipv4_mapped) - [`MaybeUninit::assume_init_read`] (https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_read) - [`MaybeUninit::zeroed`] (https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.zeroed) - [`mem::discriminant`] (https://doc.rust-lang.org/stable/core/mem/fn.discriminant.html) - [`mem::zeroed`] (https://doc.rust-lang.org/stable/core/mem/fn.zeroed.html) Cargo ----- - [Add new packages to `[workspace.members]` automatically.] (https://github.com/rust-lang/cargo/pull/12779/) - [Allow version-less `Cargo.toml` manifests.] (https://github.com/rust-lang/cargo/pull/12786/) - [Make browser links out of HTML file paths.] (https://github.com/rust-lang/cargo/pull/12889) Rustdoc ------- - [Accept less invalid Rust in rustdoc.] (https://github.com/rust-lang/rust/pull/117450/) - [Document lack of object safety on affected traits.] (https://github.com/rust-lang/rust/pull/113241/) - [Hide `#[repr(transparent)]` if it isn't part of the public ABI.] (https://github.com/rust-lang/rust/pull/115439/) - [Show enum discriminant if it is a C-like variant.] (https://github.com/rust-lang/rust/pull/116142/) Compatibility Notes ------------------- - [FreeBSD targets now require at least version 12.] (https://github.com/rust-lang/rust/pull/114521/) - [Formally demote tier 2 MIPS targets to tier 3.] (https://github.com/rust-lang/rust/pull/115238/) - [Make misalignment a hard error in `const` contexts.] (https://github.com/rust-lang/rust/pull/115524/) - [Fix detecting references to packed unsized fields.] (https://github.com/rust-lang/rust/pull/115583/) - [Remove support for compiler plugins.] (https://github.com/rust-lang/rust/pull/116412/) --- lang/rust/Makefile | 99 +++++++++---------- lang/rust/options.mk | 16 ++- .../patch-compiler_rustc__llvm_build.rs | 26 +++-- ...ler_rustc__target_src_spec_base_netbsd.rs} | 19 ++-- ...__target_src_spec_i586__unknown__netbsd.rs | 31 ------ ...target_src_spec_mipsel__unknown__netbsd.rs | 30 ------ ...tch-compiler_rustc__target_src_spec_mod.rs | 15 ++- ...spec_targets_mips64el__unknown__netbsd.rs} | 10 +- ...brary_backtrace_src_symbolize_gimli_elf.rs | 11 ++- .../patches/patch-src_bootstrap_bootstrap.py | 12 ++- lang/rust/patches/patch-src_bootstrap_lib.rs | 23 ----- ...ootstrap_src_core_build__steps_compile.rs} | 8 +- ...c_bootstrap_src_core_build__steps_llvm.rs} | 11 +-- ...> patch-src_bootstrap_src_core_builder.rs} | 8 +- .../patches/patch-src_bootstrap_src_lib.rs | 23 +++++ ...c_tools_rust-installer_install-template.sh | 4 +- ...138_src_unix_bsd_netbsdlike_netbsd_mips.rs | 29 ------ ....138_src_unix_bsd_netbsdlike_netbsd_mod.rs | 59 ----------- ..._src_unix_bsd_netbsdlike_netbsd_riscv64.rs | 31 ------ ...48_src_unix_bsd_netbsdlike+netbsd_mips.rs} | 8 +- ...148_src_unix_bsd_netbsdlike_netbsd_mod.rs} | 20 ++-- ...src_unix_bsd_netbsdlike_netbsd_riscv64.rs} | 6 +- ...dor_libc-0.2.148_src_unix_solarish_mod.rs} | 6 +- ...49_src_unix_bsd_netbsdlike_netbsd_mips.rs} | 8 +- ....149_src_unix_bsd_netbsdlike_netbsd_mod.rs | 31 ++++++ ...src_unix_bsd_netbsdlike_netbsd_riscv64.rs} | 12 +-- ...ndor_libc-0.2.149_src_unix_solarish_mod.rs | 15 +++ ...libc_src_unix_bsd_netbsdlike_netbsd_mod.rs | 59 ----------- ...patch-vendor_libc_src_unix_solarish_mod.rs | 4 +- ...patch-vendor_target-lexicon_src_targets.rs | 16 +-- lang/rust/platform.mk | 6 +- 31 files changed, 227 insertions(+), 429 deletions(-) rename lang/rust/patches/{patch-compiler_rustc__target_src_spec_netbsd__base.rs => patch-compiler_rustc__target_src_spec_base_netbsd.rs} (65%) delete mode 100644 lang/rust/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs delete mode 100644 lang/rust/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs rename lang/rust/patches/{patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs => patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs} (62%) delete mode 100644 lang/rust/patches/patch-src_bootstrap_lib.rs rename lang/rust/patches/{patch-src_bootstrap_compile.rs => patch-src_bootstrap_src_core_build__steps_compile.rs} (67%) rename lang/rust/patches/{patch-src_bootstrap_llvm.rs => patch-src_bootstrap_src_core_build__steps_llvm.rs} (59%) rename lang/rust/patches/{patch-src_bootstrap_builder.rs => patch-src_bootstrap_src_core_builder.rs} (58%) create mode 100644 lang/rust/patches/patch-src_bootstrap_src_lib.rs delete mode 100644 lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs delete mode 100644 lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs delete mode 100644 lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs rename lang/rust/patches/{patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs => patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike+netbsd_mips.rs} (66%) rename lang/rust/patches/{patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs => patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_mod.rs} (70%) rename lang/rust/patches/{patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs => patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_riscv64.rs} (68%) rename lang/rust/patches/{patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs => patch-vendor_libc-0.2.148_src_unix_solarish_mod.rs} (61%) rename lang/rust/patches/{patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs => patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mips.rs} (66%) create mode 100644 lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mod.rs rename lang/rust/patches/{patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs => patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_riscv64.rs} (63%) create mode 100644 lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_solarish_mod.rs delete mode 100644 lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs diff --git a/lang/rust/Makefile b/lang/rust/Makefile index 5baf4f0f7c86..42e03119cb86 100644 --- a/lang/rust/Makefile +++ b/lang/rust/Makefile @@ -1,9 +1,8 @@ -# $NetBSD: Makefile,v 1.302 2024/01/15 15:15:01 jperkin Exp $ +# $NetBSD: Makefile,v 1.303 2024/03/03 14:53:32 he Exp $ -DISTNAME= rustc-1.74.1-src +DISTNAME= rustc-1.75.0-src PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//} CATEGORIES= lang -PKGREVISION= 1 MASTER_SITES= https://static.rust-lang.org/dist/ MAINTAINER= pkgsrc-users@NetBSD.org @@ -14,10 +13,9 @@ LICENSE= mit OR apache-2.0 CONFLICTS+= rust-bin-[0-9]* # LLVM uses -std=c++17 -USE_CXX_FEATURES+= c++17 - +USE_CXX_FEATURES+= c++17 USE_GCC_RUNTIME= yes -USE_LANGUAGES= c c++17 +USE_LANGUAGES= c c++ USE_LIBTOOL= yes USE_TOOLS+= bash grep gmake perl:build pkg-config @@ -221,49 +219,49 @@ BUILDLINK_TRANSFORM+= opt:x86_64:arm64 DISTFILES:= ${DEFAULT_DISTFILES} .if ${MACHINE_PLATFORM:MDarwin-*-aarch64} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH:= aarch64-apple-darwin RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} .endif .if ${MACHINE_PLATFORM:MDarwin-*-x86_64} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH:= x86_64-apple-darwin RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} .endif .if ${MACHINE_PLATFORM:MLinux-*-aarch64} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH:= aarch64-unknown-linux-gnu RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} .endif .if ${MACHINE_PLATFORM:MLinux-*-earmv6hf} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH:= arm-unknown-linux-gnueabihf RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} .endif .if ${MACHINE_PLATFORM:MLinux-*-earmv7hf} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH:= armv7-unknown-linux-gnueabihf RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} .endif .if ${MACHINE_PLATFORM:MLinux-*-i386} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH:= i686-unknown-linux-gnu RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} .endif .if ${MACHINE_PLATFORM:MLinux-*-x86_64} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH:= x86_64-unknown-linux-gnu RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz @@ -275,7 +273,7 @@ DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} # x86_64-sun-solaris bootstrap and comment out the overrides. # .if ${MACHINE_PLATFORM:MSunOS-*-x86_64} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH:= x86_64-unknown-illumos RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz SITES.${RUST_STAGE0}= https://us-central.manta.mnx.io/pkgsrc/public/pkg-bootstraps/ @@ -288,14 +286,14 @@ CONFIGURE_ARGS+= --host=${RUST_ARCH} CONFIGURE_ARGS+= --target=${RUST_ARCH} .endif .if ${MACHINE_PLATFORM:MFreeBSD-*-x86_64} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH:= x86_64-unknown-freebsd RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} .endif .if ${MACHINE_PLATFORM:MNetBSD-*-i386} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH= i586-unknown-netbsd RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz @@ -315,15 +313,15 @@ pre-build-fix-paxctl: ${TOOLS_PLATFORM.paxctl} +am ${WRKDIR}/rust-bootstrap/bin/rustc .endif .if ${MACHINE_PLATFORM:MNetBSD-*-x86_64} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH= x86_64-unknown-netbsd RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} .endif .if ${MACHINE_PLATFORM:MNetBSD-*-powerpc} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 -RUST_ARCH= powerpc-unknown-netbsd-nb1 +RUST_STAGE0_VER= 1.74.1 +RUST_ARCH= powerpc-unknown-netbsd # Cross-built against NetBSD 9.0 RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz @@ -334,7 +332,7 @@ SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/} .endif .if ${MACHINE_PLATFORM:MNetBSD-*-aarch64} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH= aarch64-unknown-netbsd RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz @@ -343,7 +341,7 @@ SITES.${RUST_STAGE0}= ${MASTER_SITE_LOCAL:=rust/} SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/} .endif .if ${MACHINE_PLATFORM:MNetBSD-*-aarch64eb} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH= aarch64_be-unknown-netbsd RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz @@ -352,7 +350,7 @@ SITES.${RUST_STAGE0}= ${MASTER_SITE_LOCAL:=rust/} SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/} .endif .if ${MACHINE_PLATFORM:MNetBSD-*-sparc64} || make(distinfo) || make (makesum) || make(mdi) -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_ARCH= sparc64-unknown-netbsd RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz @@ -362,7 +360,7 @@ SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/} .endif .if ${MACHINE_PLATFORM:MNetBSD-*-earmv7hf} || make(distinfo) || make (makesum) || make(mdi) RUST_ARCH= armv7-unknown-netbsd-eabihf -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} @@ -371,7 +369,7 @@ SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/} .endif .if ${MACHINE_PLATFORM:MNetBSD-*-earmv6hf} || make(distinfo) || make (makesum) || make(mdi) RUST_ARCH= armv6-unknown-netbsd-eabihf -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} @@ -380,7 +378,7 @@ SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/} .endif .if ${MACHINE_PLATFORM:MNetBSD-*-mipsel} || make(distinfo) || make (makesum) || make(mdi) RUST_ARCH= mipsel-unknown-netbsd -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} @@ -389,7 +387,7 @@ SITES.${RUST_STD_STAGE0}= ${MASTER_SITE_LOCAL:=rust/} .endif .if ${MACHINE_PLATFORM:MNetBSD-*-riscv64} || make(distinfo) || make (makesum) || make(mdi) RUST_ARCH= riscv64gc-unknown-netbsd -RUST_STAGE0_VER= 1.73.0 +RUST_STAGE0_VER= 1.74.1 RUST_STAGE0:= rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz RUST_STD_STAGE0:= rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz DISTFILES:= ${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0} @@ -413,13 +411,14 @@ TOOLS_PATH.md5sum= ${PREFIX}/bin/gmd5sum TOOLS_PLATFORM.gzcat= ${PREFIX}/bin/gzip -cd .endif -SUBST_CLASSES+= rpath -SUBST_STAGE.rpath= pre-configure -SUBST_FILES.rpath+= compiler/rustc_codegen_ssa/src/back/linker.rs -SUBST_FILES.rpath+= compiler/rustc_target/src/spec/netbsd_base.rs -SUBST_FILES.rpath+= src/bootstrap/builder.rs -SUBST_FILES.rpath+= src/bootstrap/compile.rs -SUBST_VARS.rpath= PREFIX +SUBST_CLASSES+= prefix +SUBST_STAGE.prefix= pre-configure +SUBST_FILES.prefix+= compiler/rustc_codegen_ssa/src/back/linker.rs +SUBST_FILES.prefix+= compiler/rustc_target/src/spec/base/netbsd.rs +SUBST_FILES.prefix+= src/bootstrap/src/core/build_steps/compile.rs +SUBST_FILES.prefix+= src/bootstrap/src/core/builder.rs +SUBST_FILES.prefix+= src/bootstrap/bootstrap.py +SUBST_VARS.prefix= PREFIX # # Generate list of subst entries for various .cargo-checksum.json files. These @@ -428,37 +427,27 @@ SUBST_VARS.rpath= PREFIX # updating and verification. # -CKSUM_CRATES+= vendor/cc-1.0.73 -CKSUMS+= 38970d678de0efb4b5e2978265daa8a613a1db35fc42e669621b03fc56d5b138 -CKSUMS+= 65de0d6593a4256e5fcaf898f9468d71bab672c70a2dfab3dcb8514e9b72819c - -CKSUM_CRATES+= vendor/cc -CKSUMS+= 17a4659710aa290c4ed9c23063c7b202c5bcf2a84de33aa1f01fc6fded69a1f8 -CKSUMS+= a19bcb1a561d4ba5846f8f89fcfe6f05a3cb2e79baf8f21f53f0fba012db1b7f - CKSUM_CRATES+= vendor/libc + +CKSUM_CRATES+= vendor/libc-0.2.146 CKSUMS+= 55ce4624745e31ad226b47fde177a46176a89da3fa5030663673a115102471f9 CKSUMS+= 09ab15cd50245f4ced230b7919657ab170e06443bb0ed4baf4449d3472f5f656 CKSUMS+= 90dd33ef20dc3be8aef5bd152a6a06e7ab34f9527b3978487b593aaa16a907bd CKSUMS+= ec1cb2b8522ce7d35c9fce2f5b17a1a7e28cae9836f1cf11e267f222b72dff60 + +CKSUM_CRATES+= vendor/libc-0.2.149 +CKSUMS+= 1f1beb74c33bd3ad6a5d7aae2afdacf0ccbad0f9dacda2894d2cfdc2414174ae +CKSUMS+= 80f3168251556b3eb918056aa9563db07383f61e69a262f3af390b542fd757bb CKSUMS+= b1660c631a599a3355116e7485b88ab2f8f2929c2e37851a763431387b902f14 CKSUMS+= 990d1c6c01db31b9e5541128e4987b114f39c6808d94a5f8f048f492cfb96d78 -CKSUM_CRATES+= vendor/libc-0.2.138 -CKSUMS+= 107a4aa396b8383c66e0ace2f941450b4b69146558cdc4d9fbe33eeab51760f1 -CKSUMS+= 4be83bef456569d59405edf134e7fe8eff78f3fe35f1efd60e15405d5c822725 - -CKSUM_CRATES+= vendor/libc-0.2.140 -CKSUMS+= 4493317993af390d8aafc2cb7ace4c349dfc9d2451fd666844f04a4fa1f47442 -CKSUMS+= 537a01c3cd5507f493616193991e1135c7896aae3fc92d98ec9facbfe243d980 -CKSUMS+= 6442ed05eb390d44a03daa9800af1030f2ee3e61db98675262c227b28de51937 -CKSUMS+= ec554c837999c718786debfcfe2241984193751fcd52156323b418d96319aa95 +CKSUM_CRATES+= vendor/cc-1.0.73 +CKSUMS+= 38970d678de0efb4b5e2978265daa8a613a1db35fc42e669621b03fc56d5b138 +CKSUMS+= 65de0d6593a4256e5fcaf898f9468d71bab672c70a2dfab3dcb8514e9b72819c -CKSUM_CRATES+= vendor/libc-0.2.146 -#CKSUMS+= 6442ed05eb390d44a03daa9800af1030f2ee3e61db98675262c227b28de51937 -#CKSUMS+= ec554c837999c718786debfcfe2241984193751fcd52156323b418d96319aa95 -#CKSUMS+= 6a60a542639528a0a34b9c9a7298973ec2cf1449c59546b7b30dcef6c51874dd -#CKSUMS+= ec1cb2b8522ce7d35c9fce2f5b17a1a7e28cae9836f1cf11e267f222b72dff60 +CKSUM_CRATES+= vendor/cc +CKSUMS+= 17a4659710aa290c4ed9c23063c7b202c5bcf2a84de33aa1f01fc6fded69a1f8 +CKSUMS+= a19bcb1a561d4ba5846f8f89fcfe6f05a3cb2e79baf8f21f53f0fba012db1b7f CKSUM_CRATES+= vendor/lzma-sys CKSUMS+= 6fd5e9245db34c6f557b8bfcaf03db82fc88c3b06dbfbb5f03b2bcd138983ef9 diff --git a/lang/rust/options.mk b/lang/rust/options.mk index f05a1aaded23..ad8428716480 100644 --- a/lang/rust/options.mk +++ b/lang/rust/options.mk @@ -1,4 +1,4 @@ -# $NetBSD: options.mk,v 1.34 2024/01/15 12:24:21 adam Exp $ +# $NetBSD: options.mk,v 1.35 2024/03/03 14:53:32 he Exp $ PKG_OPTIONS_VAR= PKG_OPTIONS.rust PKG_SUPPORTED_OPTIONS+= rust-cargo-static rust-docs @@ -19,10 +19,15 @@ PKG_SUGGESTED_OPTIONS+= rust-internal-llvm PKG_SUGGESTED_OPTIONS+= rust-internal-llvm .endif -# (NetBSD)/sparc64 systems fail to build libunwind, -# a dependency of pkgsrc llvm, so use the internal one instead -.if ${MACHINE_PLATFORM:MNetBSD-*-sparc64} -PKG_SUGGESTED_OPTIONS+= rust-internal-llvm +# NetBSD/sparc64 when using the internal LLVM needs +# to not use gcc 10.4 or 10.5 (as found in 10.0_BETA or 10.0), ref. +# https://github.com/rust-lang/rust/issues/117231 +# (however, gcc from 9.x produces a working LLVM). +.if ${MACHINE_PLATFORM:MNetBSD-10.*-sparc64} +. if !empty(PKG_OPTIONS:Mrust-internal-llvm) +# Require GCC 12 (from pkgsrc) to correctly build the embedded LLVM (17.x). +GCC_REQD= 12 +. endif .endif # Bundle OpenSSL and curl into the cargo binary when producing @@ -39,6 +44,7 @@ PKG_OPTIONS_LEGACY_OPTS+= rust-llvm:rust-internal-llvm # Use the internal copy of LLVM or the external one? # .if empty(PKG_OPTIONS:Mrust-internal-llvm) +# External LLVM must be >= 15, ref. RELEASES.md BUILDLINK_API_DEPENDS.llvm+= llvm>=15 .include "../../lang/libunwind/buildlink3.mk" .include "../../lang/llvm/buildlink3.mk" diff --git a/lang/rust/patches/patch-compiler_rustc__llvm_build.rs b/lang/rust/patches/patch-compiler_rustc__llvm_build.rs index e4d250f83632..a2c911160098 100644 --- a/lang/rust/patches/patch-compiler_rustc__llvm_build.rs +++ b/lang/rust/patches/patch-compiler_rustc__llvm_build.rs @@ -1,4 +1,4 @@ -$NetBSD: patch-compiler_rustc__llvm_build.rs,v 1.15 2024/01/06 19:00:19 he Exp $ +$NetBSD: patch-compiler_rustc__llvm_build.rs,v 1.16 2024/03/03 14:53:32 he Exp $ Fix build on NetBSD HEAD-llvm. XXX there is probably a better way to do this. @@ -20,22 +20,20 @@ https://github.com/rust-lang/rust/pull/104572 } else if target.contains("windows-gnu") { println!("cargo:rustc-link-lib=shell32"); println!("cargo:rustc-link-lib=uuid"); -@@ -258,6 +262,14 @@ fn main() { - { - println!("cargo:rustc-link-lib=z"); - } else if target.contains("netbsd") { -+ // When build llvm for i486, and then need -latomic for 64-bit atomics -+ if target.starts_with("i386") -+ || target.starts_with("i486") -+ || target.starts_with("i586") +@@ -261,7 +265,11 @@ fn main() { + // On NetBSD/i386, gcc and g++ is built for i486 (to maximize backward compat) + // However, LLVM insists on using 64-bit atomics. + // This gives rise to a need to link rust itself with -latomic for these targets +- if target.starts_with("i586") || target.starts_with("i686") { ++ if target.starts_with("i386") ++ || target.starts_with("i486") ++ || target.starts_with("i586") + || target.starts_with("i686") + { -+ println!("cargo:rustc-link-lib=atomic"); -+ } + println!("cargo:rustc-link-lib=atomic"); + } println!("cargo:rustc-link-lib=z"); - println!("cargo:rustc-link-lib=execinfo"); - } -@@ -346,7 +358,13 @@ fn main() { +@@ -352,7 +360,13 @@ fn main() { "c++" } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() { // NetBSD uses a separate library when relocation is required diff --git a/lang/rust/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs b/lang/rust/patches/patch-compiler_rustc__target_src_spec_base_netbsd.rs similarity index 65% rename from lang/rust/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs rename to lang/rust/patches/patch-compiler_rustc__target_src_spec_base_netbsd.rs index 4d993338e20d..0d846bd9d230 100644 --- a/lang/rust/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs +++ b/lang/rust/patches/patch-compiler_rustc__target_src_spec_base_netbsd.rs @@ -1,21 +1,24 @@ -$NetBSD: patch-compiler_rustc__target_src_spec_netbsd__base.rs,v 1.9 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-compiler_rustc__target_src_spec_base_netbsd.rs,v 1.1 2024/03/03 14:53:32 he Exp $ For the benefit of powerpc, when libatomic-links is installed, search the directory containing the symlinks to -latomic. ---- compiler/rustc_target/src/spec/netbsd_base.rs.orig 2022-12-12 16:02:12.000000000 +0000 -+++ compiler/rustc_target/src/spec/netbsd_base.rs -@@ -1,12 +1,20 @@ +--- compiler/rustc_target/src/spec/base/netbsd.rs.orig 2024-01-06 19:57:14.887897867 +0000 ++++ compiler/rustc_target/src/spec/base/netbsd.rs +@@ -1,12 +1,23 @@ -use crate::spec::{cvs, RelroLevel, TargetOptions}; +use crate::spec::{cvs, Cc, Lld, RelroLevel, LinkerFlavor, TargetOptions}; pub fn opts() -> TargetOptions { ++ let add_linker_paths = ++ &[ ++ // For the benefit of powerpc, when libatomic-links is installed, ++ "-Wl,-R@PREFIX@/lib/libatomic", ++ "-Wl,-L@PREFIX@/lib/libatomic", ++ ]; + let pre_link_args = TargetOptions::link_args( + LinkerFlavor::Gnu(Cc::Yes, Lld::No), -+ &[ -+ // For the benefit of powerpc, when libatomic-links is installed, -+ "-Wl,-L@PREFIX@/lib/libatomic".into(), -+ ], ++ add_linker_paths + ); TargetOptions { os: "netbsd".into(), diff --git a/lang/rust/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs b/lang/rust/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs deleted file mode 100644 index 370d12b448c6..000000000000 --- a/lang/rust/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs +++ /dev/null @@ -1,31 +0,0 @@ -$NetBSD: patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs,v 1.10 2024/01/06 19:00:19 he Exp $ - -Add an i586 / pentium variant, in an effort to support AMD Geode etc. - ---- compiler/rustc_target/src/spec/i586_unknown_netbsd.rs.orig 2022-12-21 19:11:11.452711494 +0000 -+++ compiler/rustc_target/src/spec/i586_unknown_netbsd.rs -@@ -0,0 +1,24 @@ -+// use crate::spec::{Cc, Lld, LinkerFlavor, StackProbeType, Target, TargetOptions}; -+use crate::spec::{StackProbeType, Target, TargetOptions}; -+ -+pub fn target() -> Target { -+ let mut base = super::netbsd_base::opts(); -+ base.cpu = "pentium".into(); -+ base.max_atomic_width = Some(64); -+// base.pre_link_args -+// .entry(LinkerFlavor::Gnu(Cc::Yes, Lld::No)) -+// .or_default() -+// .push("-m32".into()); -+ // don't use probe-stack=inline-asm until rust-lang/rust#83139 is resolved. -+ base.stack_probes = StackProbeType::Call; -+ -+ Target { -+ llvm_target: "i586-unknown-netbsdelf".into(), -+ pointer_width: 32, -+ 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" -+ .into(), -+ arch: "x86".into(), -+ options: TargetOptions { mcount: "__mcount".into(), ..base }, -+ } -+} diff --git a/lang/rust/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs b/lang/rust/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs deleted file mode 100644 index 68dd4b386834..000000000000 --- a/lang/rust/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs +++ /dev/null @@ -1,30 +0,0 @@ -$NetBSD: patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs,v 1.4 2023/10/25 05:50:43 pin Exp $ - -Add target spec for NetBSD/mipsel. -This one uses mips32 (mips1 llvm fails), so this one is not universally -usable on NetBSD's supported 32-bit MIPS processors. - ---- compiler/rustc_target/src/spec/mipsel_unknown_netbsd.rs.orig 2022-11-06 18:16:59.750850353 +0000 -+++ compiler/rustc_target/src/spec/mipsel_unknown_netbsd.rs 2022-11-06 18:14:10.846209169 +0000 -@@ -0,0 +1,21 @@ -+use crate::abi::Endian; -+use crate::spec::{Target, TargetOptions}; -+ -+pub fn target() -> Target { -+ let mut base = super::netbsd_base::opts(); -+ base.max_atomic_width = Some(32); -+ base.cpu = "mips32".into(); -+ -+ Target { -+ llvm_target: "mipsel-unknown-netbsd".into(), -+ pointer_width: 32, -+ data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(), -+ arch: "mips".into(), -+ options: TargetOptions { -+ features: "+soft-float".into(), -+ mcount: "__mcount".into(), -+ endian: Endian::Little, -+ ..base -+ }, -+ } -+} diff --git a/lang/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs b/lang/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs index e02456fc0789..a1ee6416f141 100644 --- a/lang/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs +++ b/lang/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs @@ -1,15 +1,14 @@ -$NetBSD: patch-compiler_rustc__target_src_spec_mod.rs,v 1.15 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-compiler_rustc__target_src_spec_mod.rs,v 1.16 2024/03/03 14:53:32 he Exp $ -Add i586(pentium) and mipsel NetBSD targets. +Add entry for NetBSD/mips64el. ---- compiler/rustc_target/src/spec/mod.rs.orig 2021-03-23 16:15:10.000000000 +0000 +--- compiler/rustc_target/src/spec/mod.rs.orig 2024-01-13 14:20:59.236278792 +0000 +++ compiler/rustc_target/src/spec/mod.rs -@@ -1324,6 +1324,8 @@ supported_targets! { - ("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf), +@@ -1532,6 +1532,7 @@ supported_targets! { ("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf), + ("i586-unknown-netbsd", i586_unknown_netbsd), ("i686-unknown-netbsd", i686_unknown_netbsd), -+ ("i586-unknown-netbsd", i586_unknown_netbsd), -+ ("mipsel-unknown-netbsd", mipsel_unknown_netbsd), ++ ("mips64el-unknown-netbsd", mips64el_unknown_netbsd), + ("mipsel-unknown-netbsd", mipsel_unknown_netbsd), ("powerpc-unknown-netbsd", powerpc_unknown_netbsd), ("riscv64gc-unknown-netbsd", riscv64gc_unknown_netbsd), - ("sparc64-unknown-netbsd", sparc64_unknown_netbsd), diff --git a/lang/rust/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs b/lang/rust/patches/patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs similarity index 62% rename from lang/rust/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs rename to lang/rust/patches/patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs index 6dd540208a8e..c37266cf1d47 100644 --- a/lang/rust/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs +++ b/lang/rust/patches/patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs @@ -1,15 +1,15 @@ -$NetBSD: patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs,v 1.3 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs,v 1.1 2024/03/03 14:53:32 he Exp $ Provide a mips64el target with N32, suitable for NetBSD/mips64el. ---- compiler/rustc_target/src/spec/mips64el_unknown_netbsd.rs.orig 2022-12-29 22:55:00.640217876 +0000 -+++ compiler/rustc_target/src/spec/mips64el_unknown_netbsd.rs +--- compiler/rustc_target/src/spec/targets/mips64el_unknown_netbsd.rs.orig 2024-01-13 14:16:30.122042614 +0000 ++++ compiler/rustc_target/src/spec/targets/mips64el_unknown_netbsd.rs @@ -0,0 +1,22 @@ +use crate::abi::Endian; -+use crate::spec::{Target, TargetOptions}; ++use crate::spec::{base, Target, TargetOptions}; + +pub fn target() -> Target { -+ let mut base = super::netbsd_base::opts(); ++ let mut base = base::netbsd::opts(); + base.max_atomic_width = Some(32); + base.cpu = "mips32".into(); + diff --git a/lang/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs b/lang/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs index 3aed8a8b6de6..9c0382e68269 100644 --- a/lang/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs +++ b/lang/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs @@ -1,10 +1,10 @@ -$NetBSD: patch-library_backtrace_src_symbolize_gimli_elf.rs,v 1.6 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-library_backtrace_src_symbolize_gimli_elf.rs,v 1.7 2024/03/03 14:53:32 he Exp $ Make NetBSD also find its debug libraries, if present. --- library/backtrace/src/symbolize/gimli/elf.rs.orig 2022-04-04 09:41:26.000000000 +0000 +++ library/backtrace/src/symbolize/gimli/elf.rs -@@ -276,11 +276,16 @@ fn decompress_zlib(input: &[u8], output: +@@ -304,11 +304,17 @@ fn decompress_zlib(input: &[u8], output: } } @@ -15,9 +15,10 @@ Make NetBSD also find its debug libraries, if present. fn debug_path_exists() -> bool { cfg_if::cfg_if! { -- if #[cfg(any(target_os = "freebsd", target_os = "linux"))] { -+ if #[cfg(any(target_os = "freebsd", -+ target_os = "netbsd", +- if #[cfg(any(target_os = "freebsd", target_os = "hurd", target_os = "linux"))] { ++ if #[cfg(any(target_os = "freebsd", ++ target_os = "netbsd", ++ target_os = "hurd", + target_os = "linux"))] { use core::sync::atomic::{AtomicU8, Ordering}; static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0); diff --git a/lang/rust/patches/patch-src_bootstrap_bootstrap.py b/lang/rust/patches/patch-src_bootstrap_bootstrap.py index 8f26407b755f..9d92d8824678 100644 --- a/lang/rust/patches/patch-src_bootstrap_bootstrap.py +++ b/lang/rust/patches/patch-src_bootstrap_bootstrap.py @@ -1,7 +1,8 @@ -$NetBSD: patch-src_bootstrap_bootstrap.py,v 1.21 2024/01/06 19:00:19 he Exp $ +$NetBSD: patch-src_bootstrap_bootstrap.py,v 1.22 2024/03/03 14:53:32 he Exp $ Use `uname -p` on NetBSD, as that is reliable and sensible there. Handle earmv[67]hf for NetBSD. +Also use @PREFIX@ and not $ORIGIN in rpath. --- src/bootstrap/bootstrap.py.orig 2023-07-12 03:32:40.000000000 +0000 +++ src/bootstrap/bootstrap.py @@ -35,3 +36,12 @@ else: kernel += 'eabihf' elif cputype == 'mips': +@@ -735,7 +746,7 @@ class RustBuild(object): + rpath_entries = [ + # Relative default, all binary and dynamic libraries we ship + # appear to have this (even when `../lib` is redundant). +- "$ORIGIN/../lib", ++ "@PREFIX@/lib", + os.path.join(os.path.realpath(nix_deps_dir), "lib") + ] + patchelf_args = ["--set-rpath", ":".join(rpath_entries)] diff --git a/lang/rust/patches/patch-src_bootstrap_lib.rs b/lang/rust/patches/patch-src_bootstrap_lib.rs deleted file mode 100644 index 0de1ac593f09..000000000000 --- a/lang/rust/patches/patch-src_bootstrap_lib.rs +++ /dev/null @@ -1,23 +0,0 @@ -$NetBSD: patch-src_bootstrap_lib.rs,v 1.21 2023/10/25 05:50:43 pin Exp $ - -Don't filter out optimization flags. -FreeBSD has a particular C++ runtime library name - ---- src/bootstrap/lib.rs.orig 2021-09-06 18:42:35.000000000 +0000 -+++ src/bootstrap/lib.rs -@@ -954,14 +954,13 @@ impl Build { - .args() - .iter() - .map(|s| s.to_string_lossy().into_owned()) -- .filter(|s| !s.starts_with("-O") && !s.starts_with("/O")) - .collect::>(); - - // If we're compiling on macOS then we add a few unconditional flags - // indicating that we want libc++ (more filled out than libstdc++) and - // we want to compile for 10.7. This way we can ensure that - // LLVM/etc are all properly compiled. -- if target.contains("apple-darwin") { -+ if target.contains("apple-darwin") || target.contains("freebsd") { - base.push("-stdlib=libc++".into()); - } - diff --git a/lang/rust/patches/patch-src_bootstrap_compile.rs b/lang/rust/patches/patch-src_bootstrap_src_core_build__steps_compile.rs similarity index 67% rename from lang/rust/patches/patch-src_bootstrap_compile.rs rename to lang/rust/patches/patch-src_bootstrap_src_core_build__steps_compile.rs index c31a8bd4ec96..7c4fa862d166 100644 --- a/lang/rust/patches/patch-src_bootstrap_compile.rs +++ b/lang/rust/patches/patch-src_bootstrap_src_core_build__steps_compile.rs @@ -1,10 +1,10 @@ -$NetBSD: patch-src_bootstrap_compile.rs,v 1.14 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-src_bootstrap_src_core_build__steps_compile.rs,v 1.1 2024/03/03 14:53:32 he Exp $ On Darwin, do not use @rpath for internal libraries. ---- src/bootstrap/compile.rs.orig 2022-12-12 16:02:12.000000000 +0000 -+++ src/bootstrap/compile.rs -@@ -488,7 +488,7 @@ fn copy_sanitizers( +--- src/bootstrap/src/core/build_steps/compile.rs.orig 2024-01-06 20:42:20.028206400 +0000 ++++ src/bootstrap/src/core/build_steps/compile.rs +@@ -626,7 +626,7 @@ fn copy_sanitizers( || target == "x86_64-apple-ios" { // Update the library’s install name to reflect that it has been renamed. diff --git a/lang/rust/patches/patch-src_bootstrap_llvm.rs b/lang/rust/patches/patch-src_bootstrap_src_core_build__steps_llvm.rs similarity index 59% rename from lang/rust/patches/patch-src_bootstrap_llvm.rs rename to lang/rust/patches/patch-src_bootstrap_src_core_build__steps_llvm.rs index a5e2a98531de..b5c8dfad9c86 100644 --- a/lang/rust/patches/patch-src_bootstrap_llvm.rs +++ b/lang/rust/patches/patch-src_bootstrap_src_core_build__steps_llvm.rs @@ -1,11 +1,10 @@ -$NetBSD: patch-src_bootstrap_llvm.rs,v 1.3 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-src_bootstrap_src_core_build__steps_llvm.rs,v 1.1 2024/03/03 14:53:32 he Exp $ -Add NetBSD to the list of riscv's which don't need -latomic. -Try to force use of -latomic on mips* on NetBSD. +Force use of -latomic on mips* on NetBSD. ---- src/bootstrap/llvm.rs.orig 2023-08-03 12:13:07.000000000 +0000 -+++ src/bootstrap/llvm.rs -@@ -396,6 +396,13 @@ impl Step for Llvm { +--- src/bootstrap/src/core/build_steps/llvm.rs.orig 2024-01-06 20:59:17.436053488 +0000 ++++ src/bootstrap/src/core/build_steps/llvm.rs +@@ -402,6 +402,13 @@ impl Step for Llvm { ldflags.shared.push(" -latomic"); } diff --git a/lang/rust/patches/patch-src_bootstrap_builder.rs b/lang/rust/patches/patch-src_bootstrap_src_core_builder.rs similarity index 58% rename from lang/rust/patches/patch-src_bootstrap_builder.rs rename to lang/rust/patches/patch-src_bootstrap_src_core_builder.rs index fe889a7052cf..219ce9087263 100644 --- a/lang/rust/patches/patch-src_bootstrap_builder.rs +++ b/lang/rust/patches/patch-src_bootstrap_src_core_builder.rs @@ -1,10 +1,10 @@ -$NetBSD: patch-src_bootstrap_builder.rs,v 1.29 2024/01/06 19:00:19 he Exp $ +$NetBSD: patch-src_bootstrap_src_core_builder.rs,v 1.1 2024/03/03 14:53:32 he Exp $ Use @PREFIX@, not $ORIGIN in rpath. ---- src/bootstrap/builder.rs.orig 2023-10-03 02:52:17.000000000 +0000 -+++ src/bootstrap/builder.rs -@@ -1645,7 +1645,7 @@ impl<'a> Builder<'a> { +--- src/bootstrap/src/core/builder.rs.orig 2024-01-13 20:06:50.748741545 +0000 ++++ src/bootstrap/src/core/builder.rs +@@ -1678,7 +1678,7 @@ impl<'a> Builder<'a> { && !target.contains("xous") { rustflags.arg("-Clink-args=-Wl,-z,origin"); diff --git a/lang/rust/patches/patch-src_bootstrap_src_lib.rs b/lang/rust/patches/patch-src_bootstrap_src_lib.rs new file mode 100644 index 000000000000..e980dc74175e --- /dev/null +++ b/lang/rust/patches/patch-src_bootstrap_src_lib.rs @@ -0,0 +1,23 @@ +$NetBSD: patch-src_bootstrap_src_lib.rs,v 1.1 2024/03/03 14:53:32 he Exp $ + +Don't filter out optimization flags. +FreeBSD has a particular C++ runtime library name + +--- src/bootstrap/src/lib.rs.orig 2024-01-06 20:52:50.892941220 +0000 ++++ src/bootstrap/src/lib.rs +@@ -1195,13 +1195,13 @@ impl Build { + .args() + .iter() + .map(|s| s.to_string_lossy().into_owned()) +- .filter(|s| !s.starts_with("-O") && !s.starts_with("/O")) + .collect::>(); + + // If we're compiling C++ on macOS then we add a flag indicating that + // we want libc++ (more filled out than libstdc++), ensuring that + // LLVM/etc are all properly compiled. +- if matches!(c, CLang::Cxx) && target.contains("apple-darwin") { ++ if matches!(c, CLang::Cxx) && ++ (target.contains("apple-darwin") || target.contains("freebsd")) { + base.push("-stdlib=libc++".into()); + } + diff --git a/lang/rust/patches/patch-src_tools_rust-installer_install-template.sh b/lang/rust/patches/patch-src_tools_rust-installer_install-template.sh index 3d8c7d1d8f0d..6f7e2ba66868 100644 --- a/lang/rust/patches/patch-src_tools_rust-installer_install-template.sh +++ b/lang/rust/patches/patch-src_tools_rust-installer_install-template.sh @@ -1,4 +1,4 @@ -$NetBSD: patch-src_tools_rust-installer_install-template.sh,v 1.12 2024/01/22 11:00:16 adam Exp $ +$NetBSD: patch-src_tools_rust-installer_install-template.sh,v 1.13 2024/03/03 14:53:33 he Exp $ No logging to 'install.log'. Do not create 'uninstall.sh'. @@ -9,7 +9,7 @@ pattern matching and substitution in the install phase using "grep" and "sed" when shell builtin "case" and "omit shortest match" ops should do just fine. ---- src/tools/rust-installer/install-template.sh.orig 2023-12-04 19:48:34.000000000 +0000 +--- src/tools/rust-installer/install-template.sh.orig 2023-12-21 16:55:28.000000000 +0000 +++ src/tools/rust-installer/install-template.sh @@ -6,20 +6,12 @@ set -u init_logging() { diff --git a/lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs b/lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs deleted file mode 100644 index d2ea88ef2528..000000000000 --- a/lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs +++ /dev/null @@ -1,29 +0,0 @@ -$NetBSD: patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs,v 1.3 2023/10/25 05:50:43 pin Exp $ - -Add file for NetBSD/mips in mips32 variant. - ---- vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig 2023-04-23 15:53:16.504282187 +0000 -+++ vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mips.rs -@@ -0,0 +1,22 @@ -+use PT_FIRSTMACH; -+ -+pub type c_long = i32; -+pub type c_ulong = u32; -+pub type c_char = i8; -+pub type __cpu_simple_lock_nv_t = ::c_int; -+ -+// should be pub(crate), but that requires Rust 1.18.0 -+cfg_if! { -+ if #[cfg(libc_const_size_of)] { -+ #[doc(hidden)] -+ pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1; -+ } else { -+ #[doc(hidden)] -+ pub const _ALIGNBYTES: usize = 8 - 1; -+ } -+} -+ -+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; -+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; -+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; -+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; diff --git a/lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs b/lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs deleted file mode 100644 index 253df0747225..000000000000 --- a/lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs +++ /dev/null @@ -1,59 +0,0 @@ -$NetBSD: patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs,v 1.5 2024/01/06 19:00:19 he Exp $ - -Add execinfo / backtrace stuff for NetBSD, and handle NetBSD/mips -and NetBSD/riscv64. - -Add fix to cpuid_t definition by applying - https://github.com/rust-lang/libc/pull/3386 - ---- vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig 2023-04-16 23:32:41.000000000 +0000 -+++ vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mod.rs -@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc - pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time - pub type lwpid_t = ::c_uint; - pub type shmatt_t = ::c_uint; --pub type cpuid_t = u64; -+pub type cpuid_t = ::c_ulong; - pub type cpuset_t = _cpuset; - pub type pthread_spin_t = ::c_uchar; - pub type timer_t = ::c_int; -@@ -3049,6 +3049,22 @@ extern "C" { - pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry; - } - -+#[link(name = "execinfo")] -+extern "C" { -+ pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t; -+ pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char; -+ pub fn backtrace_symbols_fd( -+ addrlist: *const *mut ::c_void, -+ len: ::size_t, -+ fd: ::c_int, -+ ) -> ::c_int; -+ pub fn backtrace_symbols_fmt( -+ addrlist: *const *mut ::c_void, -+ len: ::size_t, -+ fmt: *const ::c_char, -+ ) -> *mut *mut ::c_char; -+} -+ - cfg_if! { - if #[cfg(target_arch = "aarch64")] { - mod aarch64; -@@ -3068,7 +3084,15 @@ cfg_if! { - } else if #[cfg(target_arch = "x86")] { - mod x86; - pub use self::x86::*; -+ } else if #[cfg(target_arch = "mips")] { -+ mod mips; -+ pub use self::mips::*; -+ } else if #[cfg(target_arch = "riscv64")] { -+ mod riscv64; -+ pub use self::riscv64:*; - } else { -- // Unknown target_arch -+ // Unknown target_arch, this should error out -+ mod unknown; -+ pub use self::unknown::*; - } - } diff --git a/lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs deleted file mode 100644 index 1cbfc6ea5fd7..000000000000 --- a/lang/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs +++ /dev/null @@ -1,31 +0,0 @@ -$NetBSD: patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs,v 1.3 2023/10/25 05:50:43 pin Exp $ - -Spec for riscv64. - ---- vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig 2023-07-02 18:40:59.815126792 +0000 -+++ vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/riscv64.rs 2023-07-02 18:38:40.729445691 +0000 -@@ -0,0 +1,24 @@ -+use PT_FIRSTMACH; -+ -+pub type c_long = i64; -+pub type c_ulong = u64; -+pub type c_char = u8; -+pub type __cpu_simple_lock_nv_t = ::c_int; -+ -+// should be pub(crate), but that requires Rust 1.18.0 -+cfg_if! { -+ if #[cfg(libc_const_size_of)] { -+ #[doc(hidden)] -+ pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; -+ } else { -+ #[doc(hidden)] -+ pub const _ALIGNBYTES: usize = 8 - 1; -+ } -+} -+ -+// pub const _MAX_PAGE_SHIFT: u32 = 12; -+ -+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0; -+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1; -+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2; -+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3; diff --git a/lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs b/lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike+netbsd_mips.rs similarity index 66% rename from lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs rename to lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike+netbsd_mips.rs index c2d58acd93e4..8684ffeda0cb 100644 --- a/lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs +++ b/lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike+netbsd_mips.rs @@ -1,9 +1,9 @@ -$NetBSD: patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs,v 1.4 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike+netbsd_mips.rs,v 1.1 2024/03/03 14:53:33 he Exp $ -Add mips support. +Add entry for NetBSD/mips. ---- vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig 2022-11-06 22:14:03.866753983 +0000 -+++ vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs 2022-11-06 22:07:15.448812020 +0000 +--- vendor/libc-0.2.148/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig 2024-01-06 21:03:21.781003759 +0000 ++++ vendor/libc-0.2.148/src/unix/bsd/netbsdlike/netbsd/mips.rs 2024-01-06 22:27:31.830676317 +0000 @@ -0,0 +1,22 @@ +use PT_FIRSTMACH; + diff --git a/lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs b/lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_mod.rs similarity index 70% rename from lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs rename to lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_mod.rs index 79b3468a3a60..70f935f47170 100644 --- a/lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs +++ b/lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_mod.rs @@ -1,10 +1,10 @@ -$NetBSD: patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs,v 1.2 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_mod.rs,v 1.1 2024/03/03 14:53:33 he Exp $ -Add support for NetBSD/mipsel and NetBSD/riscv64. -Also try to enable backtrace support. +Add entries for execinfo, and support +for NetBSD/mips and NetBSD/riscv64. ---- vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig 2023-07-12 05:06:31.000000000 +0000 -+++ vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mod.rs +--- vendor/libc-0.2.148/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig 2024-01-06 22:33:33.911876204 +0000 ++++ vendor/libc-0.2.148/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time pub type lwpid_t = ::c_uint; @@ -14,7 +14,7 @@ Also try to enable backtrace support. pub type cpuset_t = _cpuset; pub type pthread_spin_t = ::c_uchar; pub type timer_t = ::c_int; -@@ -3111,6 +3111,22 @@ extern "C" { +@@ -3153,6 +3153,22 @@ extern "C" { pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry; } @@ -37,7 +37,7 @@ Also try to enable backtrace support. cfg_if! { if #[cfg(target_arch = "aarch64")] { mod aarch64; -@@ -3130,7 +3146,15 @@ cfg_if! { +@@ -3172,6 +3188,12 @@ cfg_if! { } else if #[cfg(target_arch = "x86")] { mod x86; pub use self::x86::*; @@ -48,9 +48,5 @@ Also try to enable backtrace support. + mod riscv64; + pub use self::riscv64::*; } else { -- // Unknown target_arch -+ // Unknown target_arch, this should error out -+ mod unknown; -+ pub use self::unknown::*; + // Unknown target_arch } - } diff --git a/lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_riscv64.rs similarity index 68% rename from lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs rename to lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_riscv64.rs index a8a0d3f64324..92331a701366 100644 --- a/lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs +++ b/lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_riscv64.rs @@ -1,9 +1,9 @@ -$NetBSD: patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs,v 1.2 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-vendor_libc-0.2.148_src_unix_bsd_netbsdlike_netbsd_riscv64.rs,v 1.1 2024/03/03 14:53:33 he Exp $ Add support for NetBSD/riscv64. ---- vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig 2023-07-14 09:12:33.579150305 +0000 -+++ vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/riscv64.rs +--- vendor/libc-0.2.148/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig 2024-01-06 21:03:21.781003759 +0000 ++++ vendor/libc-0.2.148/src/unix/bsd/netbsdlike/netbsd/riscv64.rs 2024-01-06 22:31:25.289387359 +0000 @@ -0,0 +1,22 @@ +use PT_FIRSTMACH; + diff --git a/lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs b/lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_solarish_mod.rs similarity index 61% rename from lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs rename to lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_solarish_mod.rs index 3307e09ec9a1..3b21a2d98959 100644 --- a/lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs +++ b/lang/rust/patches/patch-vendor_libc-0.2.148_src_unix_solarish_mod.rs @@ -1,9 +1,9 @@ -$NetBSD: patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs,v 1.1 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-vendor_libc-0.2.148_src_unix_solarish_mod.rs,v 1.1 2024/03/03 14:53:33 he Exp $ Fix xattr build. ---- vendor/libc-0.2.140/src/unix/solarish/mod.rs.orig 2023-08-23 22:08:20.000000000 +0000 -+++ vendor/libc-0.2.140/src/unix/solarish/mod.rs +--- vendor/libc-0.2.148/src/unix/solarish/mod.rs.orig 2024-01-06 22:41:58.182128108 +0000 ++++ vendor/libc-0.2.148/src/unix/solarish/mod.rs @@ -1523,6 +1523,8 @@ pub const EOWNERDEAD: ::c_int = 58; pub const ENOTRECOVERABLE: ::c_int = 59; pub const ENOSTR: ::c_int = 60; diff --git a/lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs b/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mips.rs similarity index 66% rename from lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs rename to lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mips.rs index 304b70d4fdfc..9a9a799f596d 100644 --- a/lang/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs +++ b/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mips.rs @@ -1,9 +1,9 @@ -$NetBSD: patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs,v 1.2 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mips.rs,v 1.1 2024/03/03 14:53:33 he Exp $ -Add NetBSD/mipsel (mips32 required). +Add support for NetBSD/mipsel. ---- vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig 2023-07-14 09:09:26.430133820 +0000 -+++ vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mips.rs +--- vendor/libc-0.2.149/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig 2024-01-08 07:29:24.841727520 +0000 ++++ vendor/libc-0.2.149/src/unix/bsd/netbsdlike/netbsd/mips.rs 2024-01-08 07:30:35.869045004 +0000 @@ -0,0 +1,22 @@ +use PT_FIRSTMACH; + diff --git a/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mod.rs b/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mod.rs new file mode 100644 index 000000000000..394b910783ea --- /dev/null +++ b/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mod.rs @@ -0,0 +1,31 @@ +$NetBSD: patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_mod.rs,v 1.1 2024/03/03 14:53:33 he Exp $ + +Add support for NetBSD/riscv64 and MetBSD/mipsel. + +Add fix to cpuid_t definition by applying + https://github.com/rust-lang/libc/pull/3386 + +--- vendor/libc-0.2.149/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig 2024-01-08 07:25:50.125422539 +0000 ++++ vendor/libc-0.2.149/src/unix/bsd/netbsdlike/netbsd/mod.rs +@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc + pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time + pub type lwpid_t = ::c_uint; + pub type shmatt_t = ::c_uint; +-pub type cpuid_t = u64; ++pub type cpuid_t = ::c_ulong; + pub type cpuset_t = _cpuset; + pub type pthread_spin_t = ::c_uchar; + pub type timer_t = ::c_int; +@@ -3208,6 +3208,12 @@ cfg_if! { + } else if #[cfg(target_arch = "x86")] { + mod x86; + pub use self::x86::*; ++ } else if #[cfg(target_arch = "mips")] { ++ mod mips; ++ pub use self::mips::*; ++ } else if #[cfg(target_arch = "riscv64")] { ++ mod riscv64; ++ pub use self::riscv64::*; + } else { + // Unknown target_arch + } diff --git a/lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_riscv64.rs similarity index 63% rename from lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs rename to lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_riscv64.rs index 94f88820cf97..1ded8132560b 100644 --- a/lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs +++ b/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_riscv64.rs @@ -1,10 +1,10 @@ -$NetBSD: patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs,v 1.3 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-vendor_libc-0.2.149_src_unix_bsd_netbsdlike_netbsd_riscv64.rs,v 1.1 2024/03/03 14:53:33 he Exp $ -Spec for riscv64. +Add support for NetBSD/riscv64. ---- vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig 2023-07-02 20:13:26.244972364 +0000 -+++ vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs 2023-07-02 20:13:26.244972364 +0000 -@@ -0,0 +1,24 @@ +--- vendor/libc-0.2.149/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig 2024-01-08 07:29:24.841727520 +0000 ++++ vendor/libc-0.2.149/src/unix/bsd/netbsdlike/netbsd/riscv64.rs 2024-01-08 07:33:10.924970251 +0000 +@@ -0,0 +1,22 @@ +use PT_FIRSTMACH; + +pub type c_long = i64; @@ -23,8 +23,6 @@ Spec for riscv64. + } +} + -+// pub const _MAX_PAGE_SHIFT: u32 = 12; -+ +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2; diff --git a/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_solarish_mod.rs b/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_solarish_mod.rs new file mode 100644 index 000000000000..d9fa3686045d --- /dev/null +++ b/lang/rust/patches/patch-vendor_libc-0.2.149_src_unix_solarish_mod.rs @@ -0,0 +1,15 @@ +$NetBSD: patch-vendor_libc-0.2.149_src_unix_solarish_mod.rs,v 1.1 2024/03/03 14:53:33 he Exp $ + +Fix xattr build. + +--- vendor/libc-0.2.149/src/unix/solarish/mod.rs.orig 2024-01-08 13:00:15.626503385 +0000 ++++ vendor/libc-0.2.149/src/unix/solarish/mod.rs +@@ -1523,6 +1523,8 @@ pub const EOWNERDEAD: ::c_int = 58; + pub const ENOTRECOVERABLE: ::c_int = 59; + pub const ENOSTR: ::c_int = 60; + pub const ENODATA: ::c_int = 61; ++// This is not supported but is required for xattr ++pub const ENOATTR: ::c_int = ::ENODATA; + pub const ETIME: ::c_int = 62; + pub const ENOSR: ::c_int = 63; + pub const ENONET: ::c_int = 64; diff --git a/lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs b/lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs deleted file mode 100644 index ceec067624fe..000000000000 --- a/lang/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs +++ /dev/null @@ -1,59 +0,0 @@ -$NetBSD: patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs,v 1.9 2024/01/06 19:00:19 he Exp $ - -Copy execinfo function definitions from openbsd's mod.rs. -Add entries for NetBSD/mipsel and NetBSD/riscv64. - -Add fix to cpuid_t definition by applying - https://github.com/rust-lang/libc/pull/3386 - ---- vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig 2022-05-10 20:59:35.217463943 +0000 -+++ vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs -@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc - pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time - pub type lwpid_t = ::c_uint; - pub type shmatt_t = ::c_uint; --pub type cpuid_t = u64; -+pub type cpuid_t = ::c_ulong; - pub type cpuset_t = _cpuset; - pub type pthread_spin_t = ::c_uchar; - pub type timer_t = ::c_int; -@@ -3153,6 +3153,22 @@ extern "C" { - pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry; - } - -+#[link(name = "execinfo")] -+extern "C" { -+ pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t; -+ pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char; -+ pub fn backtrace_symbols_fd( -+ addrlist: *const *mut ::c_void, -+ len: ::size_t, -+ fd: ::c_int, -+ ) -> ::c_int; -+ pub fn backtrace_symbols_fmt( -+ addrlist: *const *mut ::c_void, -+ len: ::size_t, -+ fmt: *const ::c_char, -+ ) -> *mut *mut ::c_char; -+} -+ - cfg_if! { - if #[cfg(target_arch = "aarch64")] { - mod aarch64; -@@ -3172,7 +3188,15 @@ cfg_if! { - } else if #[cfg(target_arch = "x86")] { - mod x86; - pub use self::x86::*; -+ } else if #[cfg(target_arch = "mips")] { -+ mod mips; -+ pub use self::mips::*; -+ } else if #[cfg(target_arch = "riscv64")] { -+ mod riscv64; -+ pub use self::riscv64::*; - } else { -- // Unknown target_arch -+ // Unknown target_arch, this should error out -+ mod unknown; -+ pub use self::unknown::*; - } - } diff --git a/lang/rust/patches/patch-vendor_libc_src_unix_solarish_mod.rs b/lang/rust/patches/patch-vendor_libc_src_unix_solarish_mod.rs index d42270ed0692..be3381d97cda 100644 --- a/lang/rust/patches/patch-vendor_libc_src_unix_solarish_mod.rs +++ b/lang/rust/patches/patch-vendor_libc_src_unix_solarish_mod.rs @@ -1,10 +1,10 @@ -$NetBSD: patch-vendor_libc_src_unix_solarish_mod.rs,v 1.13 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-vendor_libc_src_unix_solarish_mod.rs,v 1.14 2024/03/03 14:53:33 he Exp $ Fix xattr build. --- vendor/libc/src/unix/solarish/mod.rs.orig 2019-05-20 13:47:24.000000000 +0000 +++ vendor/libc/src/unix/solarish/mod.rs -@@ -1215,6 +1215,8 @@ pub const EOWNERDEAD: ::c_int = 58; +@@ -1523,6 +1523,8 @@ pub const EOWNERDEAD: ::c_int = 58; pub const ENOTRECOVERABLE: ::c_int = 59; pub const ENOSTR: ::c_int = 60; pub const ENODATA: ::c_int = 61; diff --git a/lang/rust/patches/patch-vendor_target-lexicon_src_targets.rs b/lang/rust/patches/patch-vendor_target-lexicon_src_targets.rs index 222fa97b0f23..bc27408ffe7a 100644 --- a/lang/rust/patches/patch-vendor_target-lexicon_src_targets.rs +++ b/lang/rust/patches/patch-vendor_target-lexicon_src_targets.rs @@ -1,10 +1,10 @@ -$NetBSD: patch-vendor_target-lexicon_src_targets.rs,v 1.12 2023/10/25 05:50:43 pin Exp $ +$NetBSD: patch-vendor_target-lexicon_src_targets.rs,v 1.13 2024/03/03 14:53:33 he Exp $ -Add aarch64_eb, mipsel and riscv64gc for NetBSD. +Add aarch64_eb and mipsel for NetBSD. --- vendor/target-lexicon/src/targets.rs.orig 2021-05-03 21:35:46.000000000 +0000 +++ vendor/target-lexicon/src/targets.rs -@@ -1357,6 +1357,7 @@ mod tests { +@@ -1526,6 +1526,7 @@ mod tests { "aarch64-unknown-linux-gnu_ilp32", "aarch64-unknown-linux-musl", "aarch64-unknown-netbsd", @@ -12,7 +12,7 @@ Add aarch64_eb, mipsel and riscv64gc for NetBSD. "aarch64-unknown-none", "aarch64-unknown-none-softfloat", "aarch64-unknown-openbsd", -@@ -1441,6 +1442,7 @@ mod tests { +@@ -1611,6 +1612,7 @@ mod tests { "mipsel-unknown-linux-gnu", "mipsel-unknown-linux-musl", "mipsel-unknown-linux-uclibc", @@ -20,11 +20,3 @@ Add aarch64_eb, mipsel and riscv64gc for NetBSD. "mipsel-unknown-none", "mipsisa32r6el-unknown-linux-gnu", "mipsisa32r6-unknown-linux-gnu", -@@ -1478,6 +1480,7 @@ mod tests { - "riscv64gc-unknown-freebsd", - "riscv64gc-unknown-linux-gnu", - "riscv64gc-unknown-linux-musl", -+ "riscv64gc-unknown-netbsd", - "riscv64gc-unknown-none-elf", - "riscv64gc-unknown-openbsd", - "riscv64imac-unknown-none-elf", diff --git a/lang/rust/platform.mk b/lang/rust/platform.mk index f13621153886..e21e33d4041c 100644 --- a/lang/rust/platform.mk +++ b/lang/rust/platform.mk @@ -1,4 +1,4 @@ -# $NetBSD: platform.mk,v 1.20 2023/10/25 05:50:43 pin Exp $ +# $NetBSD: platform.mk,v 1.21 2024/03/03 14:53:32 he Exp $ # This file encodes whether a given platform has support for rust. @@ -7,10 +7,10 @@ .if !defined(PLATFORM_SUPPORTS_RUST) -# Rust needs NetBSD>7 +# Rust needs NetBSD>8 .for rust_arch in aarch64 earmv7hf i386 powerpc riscv64 sparc64 x86_64 . for rust_os in Darwin FreeBSD Linux NetBSD SunOS -. if ${OPSYS} != "NetBSD" || empty(OS_VERSION:M[0-7].*) +. if ${OPSYS} != "NetBSD" || empty(OS_VERSION:M[0-8].*) RUST_PLATFORMS+= ${rust_os}-*-${rust_arch} . endif . endfor