Page MenuHomeFreeBSD

D32881.id98349.diff
No OneTemporary

D32881.id98349.diff

Index: Mk/Uses/cargo.mk
===================================================================
--- Mk/Uses/cargo.mk
+++ Mk/Uses/cargo.mk
@@ -113,6 +113,7 @@
_CARGO_RUST_ARCH_amd64= x86_64
_CARGO_RUST_ARCH_i386= i686
+_CARGO_RUST_ARCH_riscv64= riscv64gc
# Environment for cargo
# - CARGO_HOME: local cache of the registry index
@@ -286,9 +287,11 @@
# configure hook. Place a config file for overriding crates-io index
# by local source directory.
cargo-configure:
+.if ${ARCH} != riscv64
# Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64
@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
+.endif
@${ECHO_MSG} "===> Cargo config:"
@${MKDIR} ${WRKDIR}/.cargo
@: > ${WRKDIR}/.cargo/config.toml
Index: lang/rust-bootstrap/Makefile
===================================================================
--- lang/rust-bootstrap/Makefile
+++ lang/rust-bootstrap/Makefile
@@ -27,7 +27,7 @@
rust>=${PORTVERSION}:lang/rust
FLAVORS= aarch64 amd64 armv6 armv7 i386 powerpc64_elfv1 powerpc64_elfv2 \
- powerpc64le powerpc
+ powerpc64le powerpc riscv64
FLAVOR?= ${FLAVORS:[1]}
USES= cpe ninja:build perl5 python:3.6+,build tar:xz
@@ -51,6 +51,7 @@
_RUST_ARCH_i386= i686
_RUST_ARCH_powerpc64_elfv1= powerpc64
_RUST_ARCH_powerpc64_elfv2= powerpc64
+_RUST_ARCH_riscv64= riscv64gc
_RUST_HOST= ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl}
_RUST_TARGET= ${_RUST_ARCH_${FLAVOR}:U${FLAVOR}}-unknown-${OPSYS:tl}
_RUST_LLVM_TARGET= ${_RUST_LLVM_TARGET_${FLAVOR}}
@@ -63,13 +64,14 @@
_RUST_LLVM_TARGET_powerpc64_elfv2= PowerPC
_RUST_LLVM_TARGET_powerpc64le= PowerPC
_RUST_LLVM_TARGET_powerpc= PowerPC
+_RUST_LLVM_TARGET_riscv64= RISCV
.include <bsd.port.pre.mk>
.if ${OPSYS} != FreeBSD
IGNORE= is only for FreeBSD
.endif
-.if ${FLAVOR} == powerpc64le && ${OSVERSION} < 1300116
+.if (${FLAVOR} == powerpc64le || ${FLAVOR} == riscv64) && ${OSVERSION} < 1300116
IGNORE= will not build on 12.x due to old system
.endif
Index: lang/rust/Makefile
===================================================================
--- lang/rust/Makefile
+++ lang/rust/Makefile
@@ -26,7 +26,7 @@
IGNORE_FreeBSD_12_powerpc= is missing a bootstrap for FreeBSD 12.x powerpc
ONLY_FOR_ARCHS?= aarch64 amd64 armv6 armv7 i386 powerpc64 powerpc64le \
- powerpc
+ powerpc riscv64
ONLY_FOR_ARCHS_REASON?= requires prebuilt bootstrap compiler
BUILD_DEPENDS= cmake:devel/cmake
@@ -68,7 +68,9 @@
# See WRKSRC/src/stage0.txt for the date and version values.
BOOTSTRAPS_DATE?= 2021-09-09
+BOOTSTRAPS_DATE_riscv64= 2021-10-21
RUST_BOOTSTRAP_VERSION?= 1.55.0
+RUST_BOOTSTRAP_VERSION_riscv64= 1.56.0
BOOTSTRAPS_SUFFIX?= ${BOOTSTRAPS_SUFFIX_${ARCH}}
BOOTSTRAPS_SUFFIX_powerpc64?= -${PPC_ABI:tl}
@@ -78,6 +80,7 @@
# Rust's target arch string might be different from *BSD arch strings
_RUST_ARCH_amd64= x86_64
_RUST_ARCH_i386= i686
+_RUST_ARCH_riscv64= riscv64gc
_RUST_TARGET= ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl}
_RUST_TARGETS= ${_RUST_TARGET}
_RUST_TOOLS= analysis cargo clippy rustfmt
@@ -157,9 +160,11 @@
.endif
do-configure:
+.if ${ARCH} != riscv64
# Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64
@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh
+.endif
.for _component in cargo rust-std rustc
@cd ${WRKDIR}/${_component}-*-${OPSYS:tl} && \
${SH} install.sh --prefix=${WRKDIR}/bootstrap --verbose
Index: lang/rust/distinfo
===================================================================
--- lang/rust/distinfo
+++ lang/rust/distinfo
@@ -49,6 +49,12 @@
SIZE (rust/2021-09-09/rust-std-1.55.0-powerpc64le-unknown-freebsd.tar.xz) = 17887308
SHA256 (rust/2021-09-09/cargo-1.55.0-powerpc64le-unknown-freebsd.tar.xz) = 9e6c36063fcf4da9e0725207c569189ab1897403be6e6037f80bda03c16e5c12
SIZE (rust/2021-09-09/cargo-1.55.0-powerpc64le-unknown-freebsd.tar.xz) = 4994980
+SHA256 (rust/2021-10-21/rustc-1.56.0-riscv64gc-unknown-freebsd.tar.xz) = 79b2b7088293bca662a8c6e89d93acb382be159099d94f40f5f64b1aa2a1aeaf
+SIZE (rust/2021-10-21/rustc-1.56.0-riscv64gc-unknown-freebsd.tar.xz) = 136992648
+SHA256 (rust/2021-10-21/rust-std-1.56.0-riscv64gc-unknown-freebsd.tar.xz) = 3b0ff3b4af0b82c791604611317758e45ab9bce45627a464d157340bc38785f0
+SIZE (rust/2021-10-21/rust-std-1.56.0-riscv64gc-unknown-freebsd.tar.xz) = 25802636
+SHA256 (rust/2021-10-21/cargo-1.56.0-riscv64gc-unknown-freebsd.tar.xz) = c42f9fefead55661b7a8f631c5fc6755040cacfdf6532d3c1a7afdcb66e7d9ca
+SIZE (rust/2021-10-21/cargo-1.56.0-riscv64gc-unknown-freebsd.tar.xz) = 24102452
SHA256 (rust/2021-09-09/rustc-1.55.0-powerpc64-unknown-freebsd-elfv2.tar.xz) = 6811bd7329e9f9a37c33e0e1a213190c5b6c26cb4c573555172d029468f032e7
SIZE (rust/2021-09-09/rustc-1.55.0-powerpc64-unknown-freebsd-elfv2.tar.xz) = 47847012
SHA256 (rust/2021-09-09/rust-std-1.55.0-powerpc64-unknown-freebsd-elfv2.tar.xz) = 892debb299bb150b8798478627ba3652d8c1f8f02b8b720f21697cda9d4af3a4
Index: lang/rust/files/riscv64/patch-compiler_rustc__llvm_build.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-compiler_rustc__llvm_build.rs
@@ -0,0 +1,11 @@
+--- compiler/rustc_llvm/build.rs.orig 2021-11-07 04:24:51 UTC
++++ compiler/rustc_llvm/build.rs
+@@ -276,7 +276,7 @@ fn main() {
+ };
+
+ // RISC-V requires libatomic for sub-word atomic operations
+- if target.starts_with("riscv") {
++ if !target.contains("freebsd") && target.starts_with("riscv") {
+ println!("cargo:rustc-link-lib=atomic");
+ }
+
Index: lang/rust/files/riscv64/patch-compiler_rustc__target_src_spec_mod.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-compiler_rustc__target_src_spec_mod.rs
@@ -0,0 +1,10 @@
+--- compiler/rustc_target/src/spec/mod.rs.orig 2021-11-04 11:23:50 UTC
++++ compiler/rustc_target/src/spec/mod.rs
+@@ -805,6 +805,7 @@ supported_targets! {
+ ("powerpc-unknown-freebsd", powerpc_unknown_freebsd),
+ ("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd),
+ ("powerpc64le-unknown-freebsd", powerpc64le_unknown_freebsd),
++ ("riscv64gc-unknown-freebsd", riscv64gc_unknown_freebsd),
+ ("x86_64-unknown-freebsd", x86_64_unknown_freebsd),
+
+ ("x86_64-unknown-dragonfly", x86_64_unknown_dragonfly),
Index: lang/rust/files/riscv64/patch-compiler_rustc__target_src_spec_riscv64gc__unknown__freebsd.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-compiler_rustc__target_src_spec_riscv64gc__unknown__freebsd.rs
@@ -0,0 +1,21 @@
+--- compiler/rustc_target/src/spec/riscv64gc_unknown_freebsd.rs.orig 2021-11-04 11:22:10 UTC
++++ compiler/rustc_target/src/spec/riscv64gc_unknown_freebsd.rs
+@@ -0,0 +1,18 @@
++use crate::spec::{CodeModel, Target, TargetOptions};
++
++pub fn target() -> Target {
++ Target {
++ llvm_target: "riscv64-unknown-freebsd".to_string(),
++ pointer_width: 64,
++ data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".to_string(),
++ arch: "riscv64".to_string(),
++ options: TargetOptions {
++ code_model: Some(CodeModel::Medium),
++ cpu: "generic-rv64".to_string(),
++ features: "+m,+a,+f,+d,+c".to_string(),
++ llvm_abiname: "lp64d".to_string(),
++ max_atomic_width: Some(64),
++ ..super::freebsd_base::opts()
++ },
++ }
++}
Index: lang/rust/files/riscv64/patch-library_backtrace_src_backtrace_mod.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-library_backtrace_src_backtrace_mod.rs
@@ -0,0 +1,10 @@
+--- library/backtrace/src/backtrace/mod.rs.orig 2021-11-10 18:42:11 UTC
++++ library/backtrace/src/backtrace/mod.rs
+@@ -138,6 +138,7 @@ cfg_if::cfg_if! {
+ unix,
+ not(target_os = "emscripten"),
+ not(all(target_os = "ios", target_arch = "arm")),
++ not(all(target_os = "freebsd", target_arch = "riscv64")),
+ ),
+ all(
+ target_env = "sgx",
Index: lang/rust/files/riscv64/patch-library_std_build.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-library_std_build.rs
@@ -0,0 +1,17 @@
+error[E0609]: no field `st_lspare` on type `&libc::stat`
+ --> library/std/src/os/./freebsd/fs.rs:152:36
+ |
+152 | self.as_inner().as_inner().st_lspare as u32
+ | ^^^^^^^^^ help: a field with a similar name exists: `st_spare`
+
+--- library/std/build.rs.orig 2021-11-07 10:37:22 UTC
++++ library/std/build.rs
+@@ -4,7 +4,7 @@ fn main() {
+ println!("cargo:rerun-if-changed=build.rs");
+ let target = env::var("TARGET").expect("TARGET was not set");
+ if target.contains("freebsd") {
+- if env::var("RUST_STD_FREEBSD_12_ABI").is_ok() {
++ if target.starts_with("riscv64") || env::var("RUST_STD_FREEBSD_12_ABI").is_ok() {
+ println!("cargo:rustc-cfg=freebsd12");
+ }
+ } else if target.contains("linux")
Index: lang/rust/files/riscv64/patch-library_std_src_os_raw_mod.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-library_std_src_os_raw_mod.rs
@@ -0,0 +1,22 @@
+--- library/std/src/os/raw/mod.rs.orig 2021-11-05 15:16:50 UTC
++++ library/std/src/os/raw/mod.rs
+@@ -68,7 +68,8 @@ type_alias! { "char.md", c_char = u8, NonZero_c_char =
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "powerpc",
+- target_arch = "powerpc64"
++ target_arch = "powerpc64",
++ target_arch = "riscv64"
+ )
+ ),
+ all(
+@@ -110,7 +111,8 @@ type_alias! { "char.md", c_char = i8, NonZero_c_char =
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "powerpc",
+- target_arch = "powerpc64"
++ target_arch = "powerpc64",
++ target_arch = "riscv64"
+ )
+ ),
+ all(
Index: lang/rust/files/riscv64/patch-library_stdarch_crates_std__detect_src_detect_os_freebsd_auxvec.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-library_stdarch_crates_std__detect_src_detect_os_freebsd_auxvec.rs
@@ -0,0 +1,12 @@
+--- library/stdarch/crates/std_detect/src/detect/os/freebsd/auxvec.rs.orig 2021-10-18 09:52:55 UTC
++++ library/stdarch/crates/std_detect/src/detect/os/freebsd/auxvec.rs
+@@ -3,7 +3,8 @@
+ any(
+ target_arch = "aarch64",
+ target_arch = "arm",
+- target_arch = "powerpc64"
++ target_arch = "powerpc64",
++ target_arch = "riscv64"
+ ),
+ allow(dead_code)
+ )]
Index: lang/rust/files/riscv64/patch-src_bootstrap_native.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-src_bootstrap_native.rs
@@ -0,0 +1,11 @@
+--- src/bootstrap/native.rs.orig 2021-10-18 09:52:36 UTC
++++ src/bootstrap/native.rs
+@@ -243,7 +243,7 @@ impl Step for Llvm {
+ }
+ }
+
+- if target.starts_with("riscv") {
++ if !target.contains("freebsd") && target.starts_with("riscv") {
+ // In RISC-V, using C++ atomics require linking to `libatomic` but the LLVM build
+ // system check cannot detect this. Therefore it is set manually here.
+ if !builder.config.llvm_tools_enabled {
Index: lang/rust/files/riscv64/patch-src_doc_rustc_src_platform-support.md
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-src_doc_rustc_src_platform-support.md
@@ -0,0 +1,10 @@
+--- src/doc/rustc/src/platform-support.md.orig 2021-11-04 11:32:01 UTC
++++ src/doc/rustc/src/platform-support.md
+@@ -261,6 +261,7 @@ target | std | host | notes
+ `riscv32gc-unknown-linux-gnu` | | | RISC-V Linux (kernel 5.4, glibc 2.33)
+ `riscv32gc-unknown-linux-musl` | | | RISC-V Linux (kernel 5.4, musl + RISCV32 support patches)
+ `riscv32imc-esp-espidf` | ✓ | | RISC-V ESP-IDF
++`riscv64gc-unknown-freebsd` | | | RISC-V FreeBSD
+ `riscv64gc-unknown-linux-musl` | | | RISC-V Linux (kernel 4.20, musl 1.2.0)
+ `s390x-unknown-linux-musl` | | | S390x Linux (kernel 2.6.32, MUSL)
+ `sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
Index: lang/rust/files/riscv64/patch-vendor_cc_src_lib.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_cc_src_lib.rs
@@ -0,0 +1,12 @@
+--- vendor/cc/src/lib.rs.orig 2021-10-18 11:05:53 UTC
++++ vendor/cc/src/lib.rs
+@@ -1700,6 +1700,9 @@ impl Build {
+ if target.contains("linux") && arch.starts_with("64") {
+ cmd.args.push(("-march=rv64gc").into());
+ cmd.args.push("-mabi=lp64d".into());
++ } else if target.contains("freebsd") && arch.starts_with("64") {
++ cmd.args.push(("-march=rv64gc").into());
++ cmd.args.push("-mabi=lp64d".into());
+ } else if target.contains("linux") && arch.starts_with("32") {
+ cmd.args.push(("-march=rv32gc").into());
+ cmd.args.push("-mabi=ilp32d".into());
Index: lang/rust/files/riscv64/patch-vendor_libc-0.2.98_build.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_libc-0.2.98_build.rs
@@ -0,0 +1,29 @@
+--- vendor/libc-0.2.98/build.rs.orig 2021-10-18 11:05:54 UTC
++++ vendor/libc-0.2.98/build.rs
+@@ -24,14 +24,19 @@ fn main() {
+ //
+ // On CI, we detect the actual FreeBSD version and match its ABI exactly,
+ // running tests to ensure that the ABI is correct.
+- match which_freebsd() {
+- Some(10) if libc_ci || rustc_dep_of_std => {
+- println!("cargo:rustc-cfg=freebsd10")
++ let target = env::var("TARGET").expect("TARGET was not set");
++ if target == "riscv64gc-unknown-freebsd" {
++ println!("cargo:rustc-cfg=freebsd13")
++ } else {
++ match which_freebsd() {
++ Some(10) if libc_ci || rustc_dep_of_std => {
++ println!("cargo:rustc-cfg=freebsd10")
++ }
++ Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
++ Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
++ Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
++ Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
+ }
+- Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
+- Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
+- Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
+- Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
+ }
+
+ // On CI: deny all warnings
Index: lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freebsdlike_freebsd_freebsd13_mod.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freebsdlike_freebsd_freebsd13_mod.rs
@@ -0,0 +1,12 @@
+--- vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs.orig 2021-11-05 13:43:34 UTC
++++ vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
+@@ -240,7 +240,8 @@ extern "C" {
+
+ cfg_if! {
+ if #[cfg(any(target_arch = "x86_64",
+- target_arch = "aarch64"))] {
++ target_arch = "aarch64",
++ target_arch = "riscv64"))] {
+ mod b64;
+ pub use self::b64::*;
+ }
Index: lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freebsdlike_freebsd_mod.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freebsdlike_freebsd_mod.rs
@@ -0,0 +1,12 @@
+--- vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/mod.rs.orig 2021-11-04 11:37:21 UTC
++++ vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/mod.rs
+@@ -1749,6 +1749,9 @@ cfg_if! {
+ } else if #[cfg(target_arch = "powerpc")] {
+ mod powerpc;
+ pub use self::powerpc::*;
++ } else if #[cfg(target_arch = "riscv64")] {
++ mod riscv64;
++ pub use self::riscv64::*;
+ } else {
+ // Unknown target_arch
+ }
Index: lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freebsdlike_freebsd_riscv64.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freebsdlike_freebsd_riscv64.rs
@@ -0,0 +1,157 @@
+--- vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/riscv64.rs.orig 2021-11-05 13:41:21 UTC
++++ vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/riscv64.rs
+@@ -0,0 +1,154 @@
++pub type c_char = u8;
++pub type c_long = i64;
++pub type c_ulong = u64;
++pub type wchar_t = ::c_int;
++pub type time_t = i64;
++pub type suseconds_t = ::c_long;
++pub type register_t = i64;
++
++// 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;
++ }
++}
++
++s_no_extra_traits! {
++ pub struct gpregs {
++ pub gp_ra: ::register_t,
++ pub gp_sp: ::register_t,
++ pub gp_gp: ::register_t,
++ pub gp_tp: ::register_t,
++ pub gp_t: [::register_t; 7],
++ pub gp_s: [::register_t; 12],
++ pub gp_a: [::register_t; 8],
++ pub gp_sepc: ::register_t,
++ pub gp_sstatus: ::register_t,
++ }
++
++ pub struct fpregs {
++ pub fp_x: [[::register_t; 2]; 32],
++ pub fp_fcsr: ::register_t,
++ pub fp_flags: ::c_int,
++ pub fp_pad: ::c_int,
++ }
++
++ pub struct mcontext_t {
++ pub mc_gpregs: gpregs,
++ pub mc_fpregs: fpregs,
++ pub mc_flags: ::c_int,
++ pub mc_pad: ::c_int,
++ pub mc_spare: [u64; 8],
++ }
++}
++
++cfg_if! {
++ if #[cfg(feature = "extra_traits")] {
++ impl PartialEq for gpregs {
++ fn eq(&self, other: &gpregs) -> bool {
++ self.gp_ra == other.gp_ra &&
++ self.gp_sp == other.gp_sp &&
++ self.gp_gp == other.gp_gp &&
++ self.gp_tp == other.gp_tp &&
++ self.gp_t.iter().zip(other.gp_t.iter()).all(|(a, b)| a == b) &&
++ self.gp_s.iter().zip(other.gp_s.iter()).all(|(a, b)| a == b) &&
++ self.gp_a.iter().zip(other.gp_a.iter()).all(|(a, b)| a == b) &&
++ self.gp_sepc == other.gp_sepc &&
++ self.gp_sstatus == other.gp_sstatus
++ }
++ }
++ impl Eq for gpregs {}
++ impl ::fmt::Debug for gpregs {
++ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
++ f.debug_struct("gpregs")
++ .field("gp_ra", &self.gp_ra)
++ .field("gp_sp", &self.gp_sp)
++ .field("gp_gp", &self.gp_gp)
++ .field("gp_tp", &self.gp_tp)
++ .field("gp_t", &self.gp_t)
++ .field("gp_s", &self.gp_s)
++ .field("gp_a", &self.gp_a)
++ .field("gp_sepc", &self.gp_sepc)
++ .field("gp_sstatus", &self.gp_sstatus)
++ .finish()
++ }
++ }
++ impl ::hash::Hash for gpregs {
++ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
++ self.gp_ra.hash(state);
++ self.gp_sp.hash(state);
++ self.gp_gp.hash(state);
++ self.gp_tp.hash(state);
++ self.gp_t.hash(state);
++ self.gp_s.hash(state);
++ self.gp_a.hash(state);
++ self.gp_sepc.hash(state);
++ self.gp_sstatus.hash(state);
++ }
++ }
++ impl PartialEq for fpregs {
++ fn eq(&self, other: &fpregs) -> bool {
++ self.fp_x == other.fp_x &&
++ self.fp_fcsr == other.fp_fcsr &&
++ self.fp_flags == other.fp_flags &&
++ self.fp_pad == other.fp_pad
++ }
++ }
++ impl Eq for fpregs {}
++ impl ::fmt::Debug for fpregs {
++ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
++ f.debug_struct("fpregs")
++ .field("fp_x", &self.fp_x)
++ .field("fp_fcsr", &self.fp_fcsr)
++ .field("fp_flags", &self.fp_flags)
++ .field("fp_pad", &self.fp_pad)
++ .finish()
++ }
++ }
++ impl ::hash::Hash for fpregs {
++ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
++ self.fp_x.hash(state);
++ self.fp_fcsr.hash(state);
++ self.fp_flags.hash(state);
++ self.fp_pad.hash(state);
++ }
++ }
++ impl PartialEq for mcontext_t {
++ fn eq(&self, other: &mcontext_t) -> bool {
++ self.mc_gpregs == other.mc_gpregs &&
++ self.mc_fpregs == other.mc_fpregs &&
++ self.mc_flags == other.mc_flags &&
++ self.mc_pad == other.mc_pad &&
++ self.mc_spare.iter().zip(other.mc_spare.iter()).all(|(a, b)| a == b)
++ }
++ }
++ impl Eq for mcontext_t {}
++ impl ::fmt::Debug for mcontext_t {
++ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
++ f.debug_struct("mcontext_t")
++ .field("mc_gpregs", &self.mc_gpregs)
++ .field("mc_fpregs", &self.mc_fpregs)
++ .field("mc_flags", &self.mc_flags)
++ .field("mc_pad", &self.mc_pad)
++ .field("mc_spare", &self.mc_spare)
++ .finish()
++ }
++ }
++ impl ::hash::Hash for mcontext_t {
++ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
++ self.mc_gpregs.hash(state);
++ self.mc_fpregs.hash(state);
++ self.mc_flags.hash(state);
++ self.mc_pad.hash(state);
++ self.mc_spare.hash(state);
++ }
++ }
++ }
++}
++
++pub const MAP_32BIT: ::c_int = 0x00080000;
++pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
Index: lang/rust/files/riscv64/patch-vendor_libc_build.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_libc_build.rs
@@ -0,0 +1,29 @@
+--- vendor/libc/build.rs.orig 2021-10-18 11:05:54 UTC
++++ vendor/libc/build.rs
+@@ -24,14 +24,19 @@ fn main() {
+ //
+ // On CI, we detect the actual FreeBSD version and match its ABI exactly,
+ // running tests to ensure that the ABI is correct.
+- match which_freebsd() {
+- Some(10) if libc_ci || rustc_dep_of_std => {
+- println!("cargo:rustc-cfg=freebsd10")
++ let target = env::var("TARGET").expect("TARGET was not set");
++ if target == "riscv64gc-unknown-freebsd" {
++ println!("cargo:rustc-cfg=freebsd13")
++ } else {
++ match which_freebsd() {
++ Some(10) if libc_ci || rustc_dep_of_std => {
++ println!("cargo:rustc-cfg=freebsd10")
++ }
++ Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
++ Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
++ Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
++ Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
+ }
+- Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
+- Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
+- Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
+- Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
+ }
+
+ // On CI: deny all warnings
Index: lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_freebsd13_mod.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_freebsd13_mod.rs
@@ -0,0 +1,12 @@
+--- vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs.orig 2021-11-05 13:43:34 UTC
++++ vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
+@@ -240,7 +240,8 @@ extern "C" {
+
+ cfg_if! {
+ if #[cfg(any(target_arch = "x86_64",
+- target_arch = "aarch64"))] {
++ target_arch = "aarch64",
++ target_arch = "riscv64"))] {
+ mod b64;
+ pub use self::b64::*;
+ }
Index: lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_mod.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_mod.rs
@@ -0,0 +1,12 @@
+--- vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs.orig 2021-11-04 11:37:21 UTC
++++ vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
+@@ -1749,6 +1749,9 @@ cfg_if! {
+ } else if #[cfg(target_arch = "powerpc")] {
+ mod powerpc;
+ pub use self::powerpc::*;
++ } else if #[cfg(target_arch = "riscv64")] {
++ mod riscv64;
++ pub use self::riscv64::*;
+ } else {
+ // Unknown target_arch
+ }
Index: lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_riscv64.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_riscv64.rs
@@ -0,0 +1,157 @@
+--- vendor/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs.orig 2021-11-05 13:41:21 UTC
++++ vendor/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs
+@@ -0,0 +1,154 @@
++pub type c_char = u8;
++pub type c_long = i64;
++pub type c_ulong = u64;
++pub type wchar_t = ::c_int;
++pub type time_t = i64;
++pub type suseconds_t = ::c_long;
++pub type register_t = i64;
++
++// 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;
++ }
++}
++
++s_no_extra_traits! {
++ pub struct gpregs {
++ pub gp_ra: ::register_t,
++ pub gp_sp: ::register_t,
++ pub gp_gp: ::register_t,
++ pub gp_tp: ::register_t,
++ pub gp_t: [::register_t; 7],
++ pub gp_s: [::register_t; 12],
++ pub gp_a: [::register_t; 8],
++ pub gp_sepc: ::register_t,
++ pub gp_sstatus: ::register_t,
++ }
++
++ pub struct fpregs {
++ pub fp_x: [[::register_t; 2]; 32],
++ pub fp_fcsr: ::register_t,
++ pub fp_flags: ::c_int,
++ pub fp_pad: ::c_int,
++ }
++
++ pub struct mcontext_t {
++ pub mc_gpregs: gpregs,
++ pub mc_fpregs: fpregs,
++ pub mc_flags: ::c_int,
++ pub mc_pad: ::c_int,
++ pub mc_spare: [u64; 8],
++ }
++}
++
++cfg_if! {
++ if #[cfg(feature = "extra_traits")] {
++ impl PartialEq for gpregs {
++ fn eq(&self, other: &gpregs) -> bool {
++ self.gp_ra == other.gp_ra &&
++ self.gp_sp == other.gp_sp &&
++ self.gp_gp == other.gp_gp &&
++ self.gp_tp == other.gp_tp &&
++ self.gp_t.iter().zip(other.gp_t.iter()).all(|(a, b)| a == b) &&
++ self.gp_s.iter().zip(other.gp_s.iter()).all(|(a, b)| a == b) &&
++ self.gp_a.iter().zip(other.gp_a.iter()).all(|(a, b)| a == b) &&
++ self.gp_sepc == other.gp_sepc &&
++ self.gp_sstatus == other.gp_sstatus
++ }
++ }
++ impl Eq for gpregs {}
++ impl ::fmt::Debug for gpregs {
++ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
++ f.debug_struct("gpregs")
++ .field("gp_ra", &self.gp_ra)
++ .field("gp_sp", &self.gp_sp)
++ .field("gp_gp", &self.gp_gp)
++ .field("gp_tp", &self.gp_tp)
++ .field("gp_t", &self.gp_t)
++ .field("gp_s", &self.gp_s)
++ .field("gp_a", &self.gp_a)
++ .field("gp_sepc", &self.gp_sepc)
++ .field("gp_sstatus", &self.gp_sstatus)
++ .finish()
++ }
++ }
++ impl ::hash::Hash for gpregs {
++ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
++ self.gp_ra.hash(state);
++ self.gp_sp.hash(state);
++ self.gp_gp.hash(state);
++ self.gp_tp.hash(state);
++ self.gp_t.hash(state);
++ self.gp_s.hash(state);
++ self.gp_a.hash(state);
++ self.gp_sepc.hash(state);
++ self.gp_sstatus.hash(state);
++ }
++ }
++ impl PartialEq for fpregs {
++ fn eq(&self, other: &fpregs) -> bool {
++ self.fp_x == other.fp_x &&
++ self.fp_fcsr == other.fp_fcsr &&
++ self.fp_flags == other.fp_flags &&
++ self.fp_pad == other.fp_pad
++ }
++ }
++ impl Eq for fpregs {}
++ impl ::fmt::Debug for fpregs {
++ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
++ f.debug_struct("fpregs")
++ .field("fp_x", &self.fp_x)
++ .field("fp_fcsr", &self.fp_fcsr)
++ .field("fp_flags", &self.fp_flags)
++ .field("fp_pad", &self.fp_pad)
++ .finish()
++ }
++ }
++ impl ::hash::Hash for fpregs {
++ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
++ self.fp_x.hash(state);
++ self.fp_fcsr.hash(state);
++ self.fp_flags.hash(state);
++ self.fp_pad.hash(state);
++ }
++ }
++ impl PartialEq for mcontext_t {
++ fn eq(&self, other: &mcontext_t) -> bool {
++ self.mc_gpregs == other.mc_gpregs &&
++ self.mc_fpregs == other.mc_fpregs &&
++ self.mc_flags == other.mc_flags &&
++ self.mc_pad == other.mc_pad &&
++ self.mc_spare.iter().zip(other.mc_spare.iter()).all(|(a, b)| a == b)
++ }
++ }
++ impl Eq for mcontext_t {}
++ impl ::fmt::Debug for mcontext_t {
++ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
++ f.debug_struct("mcontext_t")
++ .field("mc_gpregs", &self.mc_gpregs)
++ .field("mc_fpregs", &self.mc_fpregs)
++ .field("mc_flags", &self.mc_flags)
++ .field("mc_pad", &self.mc_pad)
++ .field("mc_spare", &self.mc_spare)
++ .finish()
++ }
++ }
++ impl ::hash::Hash for mcontext_t {
++ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
++ self.mc_gpregs.hash(state);
++ self.mc_fpregs.hash(state);
++ self.mc_flags.hash(state);
++ self.mc_pad.hash(state);
++ self.mc_spare.hash(state);
++ }
++ }
++ }
++}
++
++pub const MAP_32BIT: ::c_int = 0x00080000;
++pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
Index: lang/rust/files/riscv64/patch-vendor_mio_src_sys_unix_selector_kqueue.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_mio_src_sys_unix_selector_kqueue.rs
@@ -0,0 +1,20 @@
+--- vendor/mio/src/sys/unix/selector/kqueue.rs.orig 2021-10-18 11:05:54 UTC
++++ vendor/mio/src/sys/unix/selector/kqueue.rs
+@@ -51,6 +51,8 @@ type UData = *mut libc::c_void;
+ #[cfg(target_os = "netbsd")]
+ type UData = libc::intptr_t;
+
++// FreeBSD 12 added uint64_t ext[4], and RISC-V first appeared in FreeBSD 12 so
++// the libc crate uses the FreeBSD 12 ABI
+ macro_rules! kevent {
+ ($id: expr, $filter: expr, $flags: expr, $data: expr) => {
+ libc::kevent {
+@@ -60,6 +62,8 @@ macro_rules! kevent {
+ fflags: 0,
+ data: 0,
+ udata: $data as UData,
++ #[cfg(all(target_os = "freebsd", target_arch = "riscv64"))]
++ ext: [0; 4],
+ }
+ };
+ }
Index: lang/rust/files/riscv64/patch-vendor_openssl-src_src_lib.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_openssl-src_src_lib.rs
@@ -0,0 +1,10 @@
+--- vendor/openssl-src/src/lib.rs.orig 2021-11-04 11:27:54 UTC
++++ vendor/openssl-src/src/lib.rs
+@@ -260,6 +260,7 @@ impl Build {
+ "powerpc64le-unknown-freebsd" => "BSD-generic64",
+ "powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
+ "powerpc64le-unknown-linux-musl" => "linux-ppc64le",
++ "riscv64gc-unknown-freebsd" => "BSD-generic64",
+ "riscv64gc-unknown-linux-gnu" => "linux-generic64",
+ "s390x-unknown-linux-gnu" => "linux64-s390x",
+ "s390x-unknown-linux-musl" => "linux64-s390x",
Index: lang/rust/files/riscv64/patch-vendor_rustc__ap__rustc__target_src_spec_mod.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_rustc__ap__rustc__target_src_spec_mod.rs
@@ -0,0 +1,9 @@
+--- vendor/rustc-ap-rustc_target/src/spec/mod.rs.orig 2021-11-04 11:23:50 UTC
++++ vendor/rustc-ap-rustc_target/src/spec/mod.rs
+@@ -805,6 +805,7 @@ supported_targets! {
+ ("powerpc-unknown-freebsd", powerpc_unknown_freebsd),
+ ("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd),
++ ("riscv64gc-unknown-freebsd", riscv64gc_unknown_freebsd),
+ ("x86_64-unknown-freebsd", x86_64_unknown_freebsd),
+
+ ("x86_64-unknown-dragonfly", x86_64_unknown_dragonfly),
Index: lang/rust/files/riscv64/patch-vendor_rustc__ap__rustc__target_src_spec_riscv64gc__unknown__freebsd.rs
===================================================================
--- /dev/null
+++ lang/rust/files/riscv64/patch-vendor_rustc__ap__rustc__target_src_spec_riscv64gc__unknown__freebsd.rs
@@ -0,0 +1,21 @@
+--- vendor/rustc-ap-rustc_target/src/spec/riscv64gc_unknown_freebsd.rs.orig 2021-11-04 11:22:10 UTC
++++ vendor/rustc-ap-rustc_target/src/spec/riscv64gc_unknown_freebsd.rs
+@@ -0,0 +1,18 @@
++use crate::spec::{CodeModel, Target, TargetOptions};
++
++pub fn target() -> Target {
++ Target {
++ llvm_target: "riscv64-unknown-freebsd".to_string(),
++ pointer_width: 64,
++ data_layout: "e-m:e-p:64:64-i64:64-i128:128-n64-S128".to_string(),
++ arch: "riscv64".to_string(),
++ options: TargetOptions {
++ code_model: Some(CodeModel::Medium),
++ cpu: "generic-rv64".to_string(),
++ features: "+m,+a,+f,+d,+c".to_string(),
++ llvm_abiname: "lp64d".to_string(),
++ max_atomic_width: Some(64),
++ ..super::freebsd_base::opts()
++ },
++ }
++}
Index: sysutils/hexyl/files/patch-riscv64
===================================================================
--- /dev/null
+++ sysutils/hexyl/files/patch-riscv64
@@ -0,0 +1,77 @@
+--- cargo-crates/libc-0.2.98/build.rs.orig 2021-10-18 11:05:54 UTC
++++ cargo-crates/libc-0.2.98/build.rs
+@@ -24,14 +24,19 @@ fn main() {
+ //
+ // On CI, we detect the actual FreeBSD version and match its ABI exactly,
+ // running tests to ensure that the ABI is correct.
+- match which_freebsd() {
+- Some(10) if libc_ci || rustc_dep_of_std => {
+- println!("cargo:rustc-cfg=freebsd10")
++ let target = env::var("TARGET").expect("TARGET was not set");
++ if target == "riscv64gc-unknown-freebsd" {
++ println!("cargo:rustc-cfg=freebsd13")
++ } else {
++ match which_freebsd() {
++ Some(10) if libc_ci || rustc_dep_of_std => {
++ println!("cargo:rustc-cfg=freebsd10")
++ }
++ Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
++ Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
++ Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
++ Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
+ }
+- Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
+- Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
+- Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
+- Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
+ }
+
+ // On CI: deny all warnings
+--- cargo-crates/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs.orig 2021-11-05 13:43:34 UTC
++++ cargo-crates/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
+@@ -240,7 +240,8 @@ extern "C" {
+
+ cfg_if! {
+ if #[cfg(any(target_arch = "x86_64",
+- target_arch = "aarch64"))] {
++ target_arch = "aarch64",
++ target_arch = "riscv64"))] {
+ mod b64;
+ pub use self::b64::*;
+ }
+--- cargo-crates/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/mod.rs.orig 2021-11-04 11:37:21 UTC
++++ cargo-crates/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/mod.rs
+@@ -1749,6 +1749,9 @@ cfg_if! {
+ } else if #[cfg(target_arch = "powerpc")] {
+ mod powerpc;
+ pub use self::powerpc::*;
++ } else if #[cfg(target_arch = "riscv64")] {
++ mod riscv64;
++ pub use self::riscv64::*;
+ } else {
+ // Unknown target_arch
+ }
+--- cargo-crates/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/riscv64.rs.orig 2021-11-05 13:41:21 UTC
++++ cargo-crates/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/riscv64.rs
+@@ -0,0 +1,21 @@
++pub type c_char = u8;
++pub type c_long = i64;
++pub type c_ulong = u64;
++pub type wchar_t = ::c_int;
++pub type time_t = i64;
++pub type suseconds_t = ::c_long;
++pub type register_t = i64;
++
++// 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 MAP_32BIT: ::c_int = 0x00080000;
++pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4

File Metadata

Mime Type
text/plain
Expires
Mon, May 18, 4:16 AM (18 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33232780
Default Alt Text
D32881.id98349.diff (38 KB)

Event Timeline