From 2b98692fea39ad03d3ea8c8aa4f8cb9da0c27df7 Mon Sep 17 00:00:00 2001 From: Havard Eidnes Date: Fri, 19 Dec 2025 17:07:45 +0000 Subject: [PATCH 1/5] netbsd/riscv64.rs: make changes so that this builds again. --- src/unix/bsd/netbsdlike/netbsd/riscv64.rs | 37 ++++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs index 8cacb7250eddc..6cf212b073b02 100644 --- a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs @@ -1,37 +1,52 @@ -use crate::prelude::*; use crate::PT_FIRSTMACH; +use crate::prelude::*; + pub type __greg_t = u64; pub type __cpu_simple_lock_nv_t = c_int; pub type __gregset = [__greg_t; _NGREG]; -pub type __fregset = [__fpreg; _NFREG]; +pub type __fpregset = [__fpreg; _NFREG]; s! { pub struct mcontext_t { pub __gregs: __gregset, - pub __fregs: __fregset, + pub __fpregs: __fpregset, __spare: [crate::__greg_t; 7], } } -s_no_extra_traits! { - pub union __fpreg { - pub u_u64: u64, - pub u_d: c_double, - } +#[derive(Clone, Copy)] +pub union __fpreg { + pub u_u64: u64, + pub u_d: c_double, } cfg_if! { if #[cfg(feature = "extra_traits")] { impl PartialEq for __fpreg { - fn eq(&self, other: &Self) -> bool { - unsafe { self.u_u64 == other.u_u64 } + fn eq(&self, other: &__fpreg) -> bool { + unsafe { + self.u_u64 == other.u_u64 + || self.u_d == other.u_d + } } } impl Eq for __fpreg {} impl hash::Hash for __fpreg { fn hash(&self, state: &mut H) { - unsafe { self.u_u64.hash(state) }; + unsafe { + self.u_u64.hash(state); + } + } + } + impl fmt::Debug for __fpreg { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + unsafe { + f.debug_struct("__fpreg") + .field("u_u64", &self.u_u64) + .field("u_d", &self.u_d) + .finish() + } } } } From c6a09ccc9f895acb20cd16075ce644f449525db7 Mon Sep 17 00:00:00 2001 From: Havard Eidnes Date: Fri, 19 Dec 2025 17:15:42 +0000 Subject: [PATCH 2/5] netbsd/riscv64.rs: follow formatting rules. --- src/unix/bsd/netbsdlike/netbsd/riscv64.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs index 6cf212b073b02..c849b95b0fd15 100644 --- a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs @@ -1,6 +1,5 @@ -use crate::PT_FIRSTMACH; - use crate::prelude::*; +use crate::PT_FIRSTMACH; pub type __greg_t = u64; pub type __cpu_simple_lock_nv_t = c_int; @@ -25,10 +24,7 @@ cfg_if! { if #[cfg(feature = "extra_traits")] { impl PartialEq for __fpreg { fn eq(&self, other: &__fpreg) -> bool { - unsafe { - self.u_u64 == other.u_u64 - || self.u_d == other.u_d - } + unsafe { self.u_u64 == other.u_u64 || self.u_d == other.u_d } } } impl Eq for __fpreg {} From ea1ce1a72b2b3c705f2887768a21aa77d5946e83 Mon Sep 17 00:00:00 2001 From: Havard Eidnes Date: Fri, 19 Dec 2025 22:38:27 +0000 Subject: [PATCH 3/5] netbsd/riscv64.rs: another attempt at making this build properly. At least the rust compiler 1.92.0 cross-builds for this target with this version of the file. --- src/unix/bsd/netbsdlike/netbsd/riscv64.rs | 54 +++++++++++++---------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs index c849b95b0fd15..75aa02ac6b596 100644 --- a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs @@ -1,5 +1,10 @@ use crate::prelude::*; use crate::PT_FIRSTMACH; +use core::clone::Clone; +use core::cmp::Eq; +use core::cmp::PartialEq; +use core::fmt::Debug; +use core::marker::Copy; pub type __greg_t = u64; pub type __cpu_simple_lock_nv_t = c_int; @@ -14,36 +19,37 @@ s! { } } -#[derive(Clone, Copy)] pub union __fpreg { pub u_u64: u64, pub u_d: c_double, } -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for __fpreg { - fn eq(&self, other: &__fpreg) -> bool { - unsafe { self.u_u64 == other.u_u64 || self.u_d == other.u_d } - } - } - impl Eq for __fpreg {} - impl hash::Hash for __fpreg { - fn hash(&self, state: &mut H) { - unsafe { - self.u_u64.hash(state); - } - } +impl core::cmp::PartialEq for __fpreg { + fn eq(&self, other: &__fpreg) -> bool { + unsafe { self.u_u64 == other.u_u64 || self.u_d == other.u_d } + } +} +impl core::cmp::Eq for __fpreg {} +impl core::marker::Copy for __fpreg {} +impl core::clone::Clone for __fpreg { + fn clone(&self) -> __fpreg { + *self + } +} +impl hash::Hash for __fpreg { + fn hash(&self, state: &mut H) { + unsafe { + self.u_u64.hash(state); } - impl fmt::Debug for __fpreg { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("__fpreg") - .field("u_u64", &self.u_u64) - .field("u_d", &self.u_d) - .finish() - } - } + } +} +impl core::fmt::Debug for __fpreg { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + unsafe { + f.debug_struct("__fpreg") + .field("u_u64", &self.u_u64) + .field("u_d", &self.u_d) + .finish() } } } From 7f9689f687d7588c10120d2f37a10e746991aec7 Mon Sep 17 00:00:00 2001 From: Havard Eidnes Date: Fri, 19 Dec 2025 22:42:02 +0000 Subject: [PATCH 4/5] netbsd/riscv64.rs: style conformance. --- src/unix/bsd/netbsdlike/netbsd/riscv64.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs index 75aa02ac6b596..644d53a9e37be 100644 --- a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs @@ -1,11 +1,14 @@ -use crate::prelude::*; -use crate::PT_FIRSTMACH; use core::clone::Clone; -use core::cmp::Eq; -use core::cmp::PartialEq; +use core::cmp{ + Eq, + PartialEq, +}; use core::fmt::Debug; use core::marker::Copy; +use crate::prelude::*; +use crate::PT_FIRSTMACH; + pub type __greg_t = u64; pub type __cpu_simple_lock_nv_t = c_int; pub type __gregset = [__greg_t; _NGREG]; From d33a216356608ce7525fe2d16c8914cebc95b12d Mon Sep 17 00:00:00 2001 From: Havard Eidnes Date: Fri, 19 Dec 2025 22:44:11 +0000 Subject: [PATCH 5/5] netbsd/riscv64.rs: and syntax fixing as well... --- src/unix/bsd/netbsdlike/netbsd/riscv64.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs index 644d53a9e37be..cdc45b30a9418 100644 --- a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs @@ -1,5 +1,5 @@ use core::clone::Clone; -use core::cmp{ +use core::cmp::{ Eq, PartialEq, };