pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
rust: Add support for the NetBSD/riscv64 target.
Module Name: pkgsrc-wip
Committed By: Havard Eidnes <he%NetBSD.org@localhost>
Pushed By: he
Date: Mon Jul 3 22:56:11 2023 +0000
Changeset: fd5af1b7d4abb172aa0fbd47d1f39357806b638e
Modified Files:
rust/Makefile
rust/cross.mk
rust/distinfo
rust/do-cross.mk
rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
rust/patches/patch-vendor_cc_src_lib.rs
rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
rust/patches/patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_mod.rs
rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
rust/patches/patch-vendor_openssl-src_src_lib.rs
rust/patches/patch-vendor_target-lexicon_src_targets.rs
Added Files:
rust/patches/patch-compiler_rustc__target_src_spec_riscv64gc__unknown__netbsd.rs
rust/patches/patch-library_core_src_ffi_mod.rs
rust/patches/patch-src_bootstrap_llvm.rs
rust/patches/patch-vendor_cc-1.0.73_src_lib.rs
rust/patches/patch-vendor_cc-1.0.77_src_lib.rs
rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
rust/patches/patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
Log Message:
rust: Add support for the NetBSD/riscv64 target.
One caveat: this still requires libatomic, I have not been able
to find what inserts that, as it should not be required on this
port (if we follow the patterns of OpenBSD and FreeBSD).
Testing remains...
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=fd5af1b7d4abb172aa0fbd47d1f39357806b638e
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
rust/Makefile | 14 +++++++---
rust/cross.mk | 3 +++
rust/distinfo | 22 ++++++++++-----
rust/do-cross.mk | 4 +++
.../patch-compiler_rustc__target_src_spec_mod.rs | 6 +++--
...__target_src_spec_riscv64gc__unknown__netbsd.rs | 26 ++++++++++++++++++
rust/patches/patch-library_core_src_ffi_mod.rs | 20 ++++++++++++++
rust/patches/patch-src_bootstrap_llvm.rs | 15 +++++++++++
rust/patches/patch-vendor_cc-1.0.73_src_lib.rs | 16 +++++++++++
rust/patches/patch-vendor_cc-1.0.77_src_lib.rs | 16 +++++++++++
rust/patches/patch-vendor_cc_src_lib.rs | 24 ++++++++++++++---
...c-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs | 10 ++++---
...2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs | 31 ++++++++++++++++++++++
...c-0.2.139_src_unix_bsd_netbsdlike_netbsd_mod.rs | 10 ++++---
...2.139_src_unix_bsd_netbsdlike_netbsd_riscv64.rs | 31 ++++++++++++++++++++++
...ndor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs | 8 ++++--
..._libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs | 31 ++++++++++++++++++++++
rust/patches/patch-vendor_openssl-src_src_lib.rs | 5 +++-
.../patch-vendor_target-lexicon_src_targets.rs | 14 +++++++---
19 files changed, 279 insertions(+), 27 deletions(-)
diffs:
diff --git a/rust/Makefile b/rust/Makefile
index 635df4d24e..d8227ff438 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -419,15 +419,23 @@ SUBST_VARS.rpath= PREFIX
# updating and verification.
#
+CKSUM_CRATES+= vendor/cc-1.0.73
+CKSUMS+= 38970d678de0efb4b5e2978265daa8a613a1db35fc42e669621b03fc56d5b138
+CKSUMS+= 65de0d6593a4256e5fcaf898f9468d71bab672c70a2dfab3dcb8514e9b72819c
+
+CKSUM_CRATES+= vendor/cc-1.0.77
+CKSUMS+= 2403bbe39ff511ea5a517c0841d825173a4fdc8a0899c64282bba49127f0dc33
+CKSUMS+= 2b7150f466b9e0617b2c3755450db2090232f27561687d462b0a8ac0518fce87
+
CKSUM_CRATES+= vendor/libc
CKSUMS+= 6442ed05eb390d44a03daa9800af1030f2ee3e61db98675262c227b28de51937
CKSUMS+= ec554c837999c718786debfcfe2241984193751fcd52156323b418d96319aa95
CKSUMS+= 4493317993af390d8aafc2cb7ace4c349dfc9d2451fd666844f04a4fa1f47442
-CKSUMS+= ed4f1abfa290a172a65b61f6d5f3b985828dff45c11e09576c7aad9dedfc6500
+CKSUMS+= e5414483c02597e67a0aa27db7501f1a98c43ffee0151aa320586dded51f41cb
CKSUM_CRATES+= vendor/libc-0.2.139
CKSUMS+= 107a4aa396b8383c66e0ace2f941450b4b69146558cdc4d9fbe33eeab51760f1
-CKSUMS+= 129f7ffc0ebf799f2ed817c443d4de8eede26d35f629387e08951cbcd2914f4a
+CKSUMS+= 4be83bef456569d59405edf134e7fe8eff78f3fe35f1efd60e15405d5c822725
CKSUM_CRATES+= vendor/lzma-sys
CKSUMS+= 6fd5e9245db34c6f557b8bfcaf03db82fc88c3b06dbfbb5f03b2bcd138983ef9
@@ -448,7 +456,7 @@ CKSUM_CRATES+= vendor/openssl-src
CKSUMS+= 090744f85cf99a9b8412c23fca1eabb61eb45d830f0f9f0e7309be2572c1e827
CKSUMS+= 4261f87c06e6505afd9f7bdafe5aebdd153a1c6f928203cec2dd125642d60fc1
CKSUMS+= 9aeed598f844ca5b63cf222052b44fc643d6cb47a879c286b46c34bbbba618df
-CKSUMS+= dadfaa4a6a749a3d14a8cb76e25a72627973939f54ca4236182665e4a1fd9640
+CKSUMS+= 20ce1c7048d0f1168a5a00e7608c8da2205a6bbdd906f69c1f5a0e6e173db8ea
CKSUM_CRATES+= vendor/openssl-sys
CKSUMS+= d04538b63898180949bc7d9ced4806395011a3f6c5d374d4ebfdf2b30cd9cc33
diff --git a/rust/cross.mk b/rust/cross.mk
index bcf02db22c..467c0f6dff 100644
--- a/rust/cross.mk
+++ b/rust/cross.mk
@@ -20,6 +20,7 @@
#CROSS_ROOT= /u/evbarm64eb
#CROSS_ROOT= /u/i386
#CROSS_ROOT= /u/mipsel
+#CROSS_ROOT= /u/riscv64
#CROSS_ROOT= /
#MAKE_ENV+= CROSS_ROOT=${CROSS_ROOT}
@@ -32,6 +33,7 @@
#GNU_CROSS_TARGET= aarch64_be--netbsd
#GNU_CROSS_TARGET= i486--netbsdelf
#GNU_CROSS_TARGET= mipsel--netbsd
+#GNU_CROSS_TARGET= riscv64--netbsd
#MAKE_ENV+= GNU_CROSS_TARGET=${GNU_CROSS_TARGET}
# To cross-build rust, you need to specify
@@ -47,6 +49,7 @@
#TARGET= i686-unknown-netbsd
#TARGET= i586-unknown-netbsd
#TARGET= mipsel-unknown-netbsd
+#TARGET= riscv64gc-unknown-netbsd
#
#SCRIPTS= ${WRKDIR}/scripts
#CONFIGURE_ARGS+= --host=${TARGET}
diff --git a/rust/distinfo b/rust/distinfo
index d4aa94fa12..e23301448d 100644
--- a/rust/distinfo
+++ b/rust/distinfo
@@ -120,10 +120,12 @@ SHA1 (patch-compiler_rustc__target_src_spec_aarch64__be__unknown__netbsd.rs) = c
SHA1 (patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs) = 866d01e7c1f3d8dd7d26f2fdc4360df273ed401f
SHA1 (patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs) = a0fb5338d0020d3ee1266d1ed1361e7bf2eea611
SHA1 (patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs) = fc78fc681f170be9e3b6e3c823a6bd62da742cbd
-SHA1 (patch-compiler_rustc__target_src_spec_mod.rs) = 5042a89fe5da4219b54082c104a1b44ba7cc395e
+SHA1 (patch-compiler_rustc__target_src_spec_mod.rs) = effb8250d07dc9ed1d5735060c528a46c422c10e
SHA1 (patch-compiler_rustc__target_src_spec_netbsd__base.rs) = bc73a140d7b1d3ced12ad2564be4edce5b9579f0
+SHA1 (patch-compiler_rustc__target_src_spec_riscv64gc__unknown__netbsd.rs) = 56abcfc73bc61960f7c680c856f54b50ec053f30
SHA1 (patch-library_backtrace_src_symbolize_gimli.rs) = 32ab8ea3809cd4f6fee9fc0df5db47d76ccbd9d2
SHA1 (patch-library_backtrace_src_symbolize_gimli_elf.rs) = 56621c10310914672a851cf5dfbf343a9ff4e1be
+SHA1 (patch-library_core_src_ffi_mod.rs) = 7678d57edc05a66abca73d4676cbb7bd588741bc
SHA1 (patch-library_std_src_sys_unix_mod.rs) = f8669d680f169137ac2891af2977909619366a97
SHA1 (patch-library_std_src_sys_unix_thread.rs) = 36a3085500ecbb34f8ecc08388c164da54bdf5d4
SHA1 (patch-library_std_src_sys_unix_thread__parking_netbsd.rs) = c29eb1cf074766d34bd2b8c348ce29c6ae2ba163
@@ -131,6 +133,7 @@ SHA1 (patch-src_bootstrap_bootstrap.py) = 4ed2fd1a43c1e0bae842c3c82012143c28346c
SHA1 (patch-src_bootstrap_builder.rs) = 98daac929d2bbc9c475c39d225d50d37491528a8
SHA1 (patch-src_bootstrap_compile.rs) = 71b58c0e14b820dafc48ce087292267e7d2eed0f
SHA1 (patch-src_bootstrap_lib.rs) = f6918e0939b6fe63ae9b524d4c809375149efb15
+SHA1 (patch-src_bootstrap_llvm.rs) = 49cbd9c695bd1f6c635300490e69baefcc80323c
SHA1 (patch-src_llvm-project_llvm_CMakeLists.txt) = 7abfabb6ec70df229a69355f8c76825610165c37
SHA1 (patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake) = 67de0d9fc105ef7ea7a0d96fa25fc779c2b89024
SHA1 (patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h) = cb011fc19957883c01725797f7c85ed1b20f96f1
@@ -142,23 +145,28 @@ SHA1 (patch-src_tools_cargo_tests_testsuite_build.rs) = 60713699c968f3e389f486e7
SHA1 (patch-src_tools_rust-installer_install-template.sh) = ca769db07986ded26d92957e1055961895def546
SHA1 (patch-vendor_backtrace_src_symbolize_gimli.rs) = b93148ff72a60a17c6a444f2616386c40d872153
SHA1 (patch-vendor_backtrace_src_symbolize_gimli_elf.rs) = 308538090d9ce11d206d6eef0e675581a1fc6e80
-SHA1 (patch-vendor_cc_src_lib.rs) = dc40f4fb0f7508b886d6d93b27e9936403a96765
+SHA1 (patch-vendor_cc-1.0.73_src_lib.rs) = 98acea9fb98898f63bbb0f6555df5e4b15da2b85
+SHA1 (patch-vendor_cc-1.0.77_src_lib.rs) = 19d5608a2afa6d325bc1f47a48551797a1be8453
+SHA1 (patch-vendor_cc_src_lib.rs) = b03998072fda91995e9aa5e81bb590da99a4c004
SHA1 (patch-vendor_crossbeam-epoch_no__atomic.rs) = 0b38d2314d9187ab745f2aa426015794c18f206c
SHA1 (patch-vendor_crossbeam-utils_no__atomic.rs) = 074bd55721719275275b35d941bc138670e4d63c
SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs) = eda31064a08cba20fc0652b669e419871875ae29
-SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs) = ce0906db31e9f4664b2683cf93f3940d97a311cd
+SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs) = e9c180ddbbd06ba2e0701bec11f1e6c954c0a0d4
+SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 24ebcb044aeefec3415323b77ac25805a98b296e
SHA1 (patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_mips.rs) = aa7d06c87a6826e7187c57a72bf27ecc55ab3e8e
-SHA1 (patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_mod.rs) = e002d810638e7821563285d83a0d1a27ad551d5d
+SHA1 (patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_mod.rs) = c134584dadea923a33140474a30b0c55207d59d1
+SHA1 (patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 77b58e2e1e136ad9913d2304bc64b9958e852227
SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs) = 09326b70d7821b1742285c464c70b347400191d7
-SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 5b74832fac31de5064eee07e240be4acdbb8606c
+SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 50df059ffa3426a73e6978fe22c6e053eed8dce4
+SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 29e7a98dff00e092b89428a8ed464da503cba60d
SHA1 (patch-vendor_libc_src_unix_solarish_mod.rs) = 8364e19ea09203d32494c37ff3db19fe3d6b9d8a
SHA1 (patch-vendor_lzma-sys_config.h) = b654c7e129fa02697734bc87173f89b3056a5437
SHA1 (patch-vendor_nix_src_sys_signal.rs) = bf4fcdc5b71d8d73b3d7e8acfccd0554d822c131
SHA1 (patch-vendor_openssl-src_openssl_Configurations_10-main.conf) = 1c4e1d5520776e70d588f3da0fd54b6f956835b5
-SHA1 (patch-vendor_openssl-src_src_lib.rs) = 918fac850f3a6e948d25ef3f673ef62345de386f
+SHA1 (patch-vendor_openssl-src_src_lib.rs) = 9511c09ed2bf035d3c1e684492bbb8f46d4e58ef
SHA1 (patch-vendor_openssl-sys_build_find__normal.rs) = 8c4311cdd2bd66882fa8406e28119a0144df5301
SHA1 (patch-vendor_openssl-sys_build_main.rs) = 20618b13b56cc93bb5c051f96046604dd4977345
SHA1 (patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs) = 4e86aec4c89db9a331950a12f8ec7b8aaa50eed7
SHA1 (patch-vendor_stacker_src_lib.rs) = e00a1e95eb16540ff182715db778bf97ebd07a5e
-SHA1 (patch-vendor_target-lexicon_src_targets.rs) = 7aab839a16e51534aee01a8d3098d7a916803ec4
+SHA1 (patch-vendor_target-lexicon_src_targets.rs) = 8562658e5f11ab1cf977d83fc48c4b3c000fbc0e
SHA1 (patch-vendor_valuable_no__atomic.rs) = 3a40cb846bf1fae864c55a0ddba8fdeb5efcba72
diff --git a/rust/do-cross.mk b/rust/do-cross.mk
index bc82b390ed..f15da4777f 100644
--- a/rust/do-cross.mk
+++ b/rust/do-cross.mk
@@ -13,6 +13,7 @@ SHORT_TARGETS+= arm64
SHORT_TARGETS+= arm64_be
SHORT_TARGETS+= i386
SHORT_TARGETS+= mipsel # produces mips32 (not mips1) executables
+SHORT_TARGETS+= riscv64
# Conditional local overrides of ROOT.* variables:
.sinclude "local-roots.mk"
@@ -27,6 +28,7 @@ ROOT.arm64?= /u/evbarm64
ROOT.arm64_be?= /u/evbarm64eb
ROOT.i386?= /u/i386
ROOT.mipsel?= /u/mipsel
+ROOT.riscv64?= /u/riscv64
# Mapping to GNU triple
G_TGT.armv7= armv7--netbsdelf-eabihf
@@ -37,6 +39,7 @@ G_TGT.arm64= aarch64--netbsd
G_TGT.arm64_be= aarch64_be--netbsd
G_TGT.i386= i486--netbsdelf
G_TGT.mipsel= mipsel--netbsd
+G_TGT.riscv64 riscv64--netbsd
# Mapping to rust's TARGET specification
TGT.armv7= armv7-unknown-netbsd-eabihf
@@ -47,6 +50,7 @@ TGT.arm64= aarch64-unknown-netbsd
TGT.arm64_be= aarch64_be-unknown-netbsd
TGT.i386= i586-unknown-netbsd
TGT.mipsel= mipsel-unknown-netbsd
+TGT.riscv64= riscv64gc-unknown-netbsd
# Optional target tweak for bootstrap files
TT.powerpc= powerpc-unknown-netbsd90
diff --git a/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs b/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
index ff546f34be..bc6de18830 100644
--- a/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
+++ b/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
@@ -1,10 +1,10 @@
$NetBSD$
-Add i586(pentium), aarch64_be and mips NetBSD targets.
+Add i586(pentium), aarch64_be, mipsel and riscv64gc NetBSD targets.
--- compiler/rustc_target/src/spec/mod.rs.orig 2021-03-23 16:15:10.000000000 +0000
+++ compiler/rustc_target/src/spec/mod.rs
-@@ -989,9 +989,12 @@ supported_targets! {
+@@ -1100,10 +1100,14 @@ supported_targets! {
("x86_64-unknown-openbsd", x86_64_unknown_openbsd),
("aarch64-unknown-netbsd", aarch64_unknown_netbsd),
@@ -15,5 +15,7 @@ Add i586(pentium), aarch64_be and mips NetBSD targets.
+ ("i586-unknown-netbsd", i586_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),
("x86_64-unknown-netbsd", x86_64_unknown_netbsd),
+
diff --git a/rust/patches/patch-compiler_rustc__target_src_spec_riscv64gc__unknown__netbsd.rs b/rust/patches/patch-compiler_rustc__target_src_spec_riscv64gc__unknown__netbsd.rs
new file mode 100644
index 0000000000..f582664e2e
--- /dev/null
+++ b/rust/patches/patch-compiler_rustc__target_src_spec_riscv64gc__unknown__netbsd.rs
@@ -0,0 +1,26 @@
+$NetBSD$
+
+Target spec for NetBSD/riscv64.
+
+--- compiler/rustc_target/src/spec/riscv64gc_unknown_netbsd.rs.orig 2023-07-02 04:17:02.369254026 +0000
++++ compiler/rustc_target/src/spec/riscv64gc_unknown_netbsd.rs 2023-07-02 18:24:04.339160957 +0000
+@@ -0,0 +1,19 @@
++use crate::spec::{CodeModel, Target, TargetOptions};
++
++pub fn target() -> Target {
++ Target {
++ llvm_target: "riscv64-unknown-netbsd".into(),
++ pointer_width: 64,
++ data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
++ arch: "riscv64".into(),
++ options: TargetOptions {
++ code_model: Some(CodeModel::Medium),
++ cpu: "generic-rv64".into(),
++ features: "+m,+a,+f,+d,+c".into(),
++ llvm_abiname: "lp64d".into(),
++ max_atomic_width: Some(64),
++ mcount: "__mcount".into(),
++ ..super::netbsd_base::opts()
++ },
++ }
++}
diff --git a/rust/patches/patch-library_core_src_ffi_mod.rs b/rust/patches/patch-library_core_src_ffi_mod.rs
new file mode 100644
index 0000000000..fdd9bfe53f
--- /dev/null
+++ b/rust/patches/patch-library_core_src_ffi_mod.rs
@@ -0,0 +1,20 @@
+$NetBSD$
+
+NetBSD/riscv64 also has unsigned chars.
+
+--- library/core/src/ffi/mod.rs.orig 2023-05-31 19:28:10.000000000 +0000
++++ library/core/src/ffi/mod.rs
+@@ -132,7 +132,12 @@ mod c_char_definition {
+ ),
+ all(
+ target_os = "netbsd",
+- any(target_arch = "aarch64", target_arch = "arm", target_arch = "powerpc")
++ any(
++ target_arch = "aarch64",
++ target_arch = "arm",
++ target_arch = "powerpc",
++ target_arch = "riscv64"
++ )
+ ),
+ all(
+ target_os = "vxworks",
diff --git a/rust/patches/patch-src_bootstrap_llvm.rs b/rust/patches/patch-src_bootstrap_llvm.rs
new file mode 100644
index 0000000000..5d44f968fe
--- /dev/null
+++ b/rust/patches/patch-src_bootstrap_llvm.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Add NetBSD to the list of riscv's which don't need -latomic.
+
+--- src/bootstrap/llvm.rs.orig 2023-05-31 19:28:10.000000000 +0000
++++ src/bootstrap/llvm.rs
+@@ -379,7 +379,7 @@ impl Step for Llvm {
+ cfg.define("LLVM_LINK_LLVM_DYLIB", "ON");
+ }
+
+- if target.starts_with("riscv") && !target.contains("freebsd") && !target.contains("openbsd")
++ if target.starts_with("riscv") && !target.contains("freebsd") && !target.contains("openbsd") && !target.contains("netbsd")
+ {
+ // RISC-V GCC erroneously requires linking against
+ // `libatomic` when using 1-byte and 2-byte C++
diff --git a/rust/patches/patch-vendor_cc-1.0.73_src_lib.rs b/rust/patches/patch-vendor_cc-1.0.73_src_lib.rs
new file mode 100644
index 0000000000..864beacf10
--- /dev/null
+++ b/rust/patches/patch-vendor_cc-1.0.73_src_lib.rs
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Use correct ABI on NetBSD/riscv64.
+
+--- vendor/cc-1.0.73/src/lib.rs.orig 2023-05-31 21:44:47.000000000 +0000
++++ vendor/cc-1.0.73/src/lib.rs
+@@ -1830,6 +1830,9 @@ impl Build {
+ } 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("netbsd") && arch.starts_with("64") {
++ cmd.args.push(("-march=rv64gc").into());
++ cmd.args.push("-mabi=lp64d".into());
+ } else if target.contains("openbsd") && arch.starts_with("64") {
+ cmd.args.push(("-march=rv64gc").into());
+ cmd.args.push("-mabi=lp64d".into());
diff --git a/rust/patches/patch-vendor_cc-1.0.77_src_lib.rs b/rust/patches/patch-vendor_cc-1.0.77_src_lib.rs
new file mode 100644
index 0000000000..fb5439d367
--- /dev/null
+++ b/rust/patches/patch-vendor_cc-1.0.77_src_lib.rs
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Use correct ABI on NetBSD/riscv64.
+
+--- vendor/cc-1.0.77/src/lib.rs.orig 2023-05-31 21:44:47.000000000 +0000
++++ vendor/cc-1.0.77/src/lib.rs
+@@ -1913,6 +1913,9 @@ impl Build {
+ } 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("netbsd") && arch.starts_with("64") {
++ cmd.args.push(("-march=rv64gc").into());
++ cmd.args.push("-mabi=lp64d".into());
+ } else if target.contains("openbsd") && arch.starts_with("64") {
+ cmd.args.push(("-march=rv64gc").into());
+ cmd.args.push("-mabi=lp64d".into());
diff --git a/rust/patches/patch-vendor_cc_src_lib.rs b/rust/patches/patch-vendor_cc_src_lib.rs
index cfc559a779..7908dc5d46 100644
--- a/rust/patches/patch-vendor_cc_src_lib.rs
+++ b/rust/patches/patch-vendor_cc_src_lib.rs
@@ -1,10 +1,20 @@
$NetBSD$
-Add aarch64_eb and mipsel for NetBSD.
+Add aarch64_eb, mipsel and riscv64 for NetBSD.
--- vendor/cc/src/lib.rs.orig 2021-07-26 15:20:38.000000000 +0000
+++ vendor/cc/src/lib.rs
-@@ -2551,6 +2551,7 @@ impl Build {
+@@ -1933,6 +1933,9 @@ impl Build {
+ } 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("netbsd") && arch.starts_with("64") {
++ cmd.args.push(("-march=rv64gc").into());
++ cmd.args.push("-mabi=lp64d".into());
+ } else if target.contains("openbsd") && arch.starts_with("64") {
+ cmd.args.push(("-march=rv64gc").into());
+ cmd.args.push("-mabi=lp64d".into());
+@@ -2744,6 +2747,7 @@ impl Build {
"aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"),
"aarch64-unknown-linux-musl" => Some("aarch64-linux-musl"),
"aarch64-unknown-netbsd" => Some("aarch64--netbsd"),
@@ -12,7 +22,7 @@ Add aarch64_eb and mipsel for NetBSD.
"arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
"armv4t-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
"armv5te-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
-@@ -2585,6 +2586,7 @@ impl Build {
+@@ -2778,6 +2782,7 @@ impl Build {
"mips-unknown-linux-musl" => Some("mips-linux-musl"),
"mipsel-unknown-linux-gnu" => Some("mipsel-linux-gnu"),
"mipsel-unknown-linux-musl" => Some("mipsel-linux-musl"),
@@ -20,3 +30,11 @@ Add aarch64_eb and mipsel for NetBSD.
"mips64-unknown-linux-gnuabi64" => Some("mips64-linux-gnuabi64"),
"mips64el-unknown-linux-gnuabi64" => Some("mips64el-linux-gnuabi64"),
"mipsisa32r6-unknown-linux-gnu" => Some("mipsisa32r6-linux-gnu"),
+@@ -2819,6 +2824,7 @@ impl Build {
+ "riscv32-unknown-elf",
+ "riscv-none-embed",
+ ]),
++ "riscv64gc-unknown-netbsd" => Some("riscv64--netbsd"),
+ "riscv64gc-unknown-linux-gnu" => Some("riscv64-linux-gnu"),
+ "riscv32gc-unknown-linux-gnu" => Some("riscv32-linux-gnu"),
+ "riscv64gc-unknown-linux-musl" => Some("riscv64-linux-musl"),
diff --git a/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
index d63da335d4..a3b96c2394 100644
--- a/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
+++ b/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
@@ -1,6 +1,7 @@
$NetBSD$
-Add execinfo / backtrace stuff for NetBSD, and handle NetBSD/mips.
+Add execinfo / backtrace stuff for NetBSD, and handle NetBSD/mips
+and NetBSD/riscv64.
--- 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
@@ -27,13 +28,16 @@ Add execinfo / backtrace stuff for NetBSD, and handle NetBSD/mips.
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
-@@ -3068,7 +3084,12 @@ cfg_if! {
+@@ -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::*;
++ 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
diff --git a/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
new file mode 100644
index 0000000000..1d49d0e5ff
--- /dev/null
+++ b/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
@@ -0,0 +1,31 @@
+$NetBSD$
+
+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/rust/patches/patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust/patches/patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_mod.rs
index 710a4e79ae..c44b1a8714 100644
--- a/rust/patches/patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_mod.rs
+++ b/rust/patches/patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_mod.rs
@@ -1,10 +1,11 @@
$NetBSD$
-Add execinfo / backtrace stuff for NetBSD, and handle NetBSD/mips.
+Add execinfo / backtrace stuff for NetBSD, and handle NetBSD/mips
+and NetBSD/riscv64.
--- vendor/libc-0.2.139/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig 2023-04-16 23:32:41.000000000 +0000
+++ vendor/libc-0.2.139/src/unix/bsd/netbsdlike/netbsd/mod.rs
-@@ -3025,6 +3025,23 @@ extern "C" {
+@@ -3049,6 +3049,23 @@ extern "C" {
pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
}
@@ -28,13 +29,16 @@ Add execinfo / backtrace stuff for NetBSD, and handle NetBSD/mips.
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
-@@ -3044,7 +3061,12 @@ cfg_if! {
+@@ -3068,7 +3085,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
diff --git a/rust/patches/patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust/patches/patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
new file mode 100644
index 0000000000..5e50328921
--- /dev/null
+++ b/rust/patches/patch-vendor_libc-0.2.139_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Spec for riscv64.
+
+--- vendor/libc-0.2.139/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig 2023-07-02 18:40:59.815126792 +0000
++++ vendor/libc-0.2.139/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/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
index a8eae5a15a..f2eaec9ee6 100644
--- a/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
+++ b/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
@@ -1,10 +1,11 @@
$NetBSD$
Copy execinfo function definitions from openbsd's mod.rs.
+Add entries for NetBSD/mipsel and NetBSD/riscv64.
--- 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
-@@ -3008,6 +3008,22 @@ extern "C" {
+@@ -3111,6 +3111,22 @@ extern "C" {
pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
}
@@ -27,13 +28,16 @@ Copy execinfo function definitions from openbsd's mod.rs.
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
-@@ -3027,7 +3043,12 @@ cfg_if! {
+@@ -3130,7 +3146,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
diff --git a/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
new file mode 100644
index 0000000000..94c1d3f916
--- /dev/null
+++ b/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Spec for 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 @@
++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/rust/patches/patch-vendor_openssl-src_src_lib.rs b/rust/patches/patch-vendor_openssl-src_src_lib.rs
index 16b3666581..66040a7b6d 100644
--- a/rust/patches/patch-vendor_openssl-src_src_lib.rs
+++ b/rust/patches/patch-vendor_openssl-src_src_lib.rs
@@ -47,8 +47,11 @@ Provide defaults for the various NetBSD targets.
"powerpc64-unknown-freebsd" => "BSD-generic64",
"powerpc64-unknown-linux-gnu" => "linux-ppc64",
"powerpc64-unknown-linux-musl" => "linux-ppc64",
-@@ -274,6 +282,7 @@ impl Build {
+@@ -272,8 +280,10 @@ impl Build {
+ "powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
+ "powerpc64le-unknown-linux-musl" => "linux-ppc64le",
"riscv64gc-unknown-linux-gnu" => "linux-generic64",
++ "riscv64gc-unknown-netbsd" => "BSD-generic64",
"s390x-unknown-linux-gnu" => "linux64-s390x",
"s390x-unknown-linux-musl" => "linux64-s390x",
+ "sparc64-unknown-netbsd" => "BSD-generic64",
diff --git a/rust/patches/patch-vendor_target-lexicon_src_targets.rs b/rust/patches/patch-vendor_target-lexicon_src_targets.rs
index a021070993..7771d25feb 100644
--- a/rust/patches/patch-vendor_target-lexicon_src_targets.rs
+++ b/rust/patches/patch-vendor_target-lexicon_src_targets.rs
@@ -1,10 +1,10 @@
$NetBSD$
-Add aarch64_eb and mipsel for NetBSD.
+Add aarch64_eb, mipsel and riscv64gc for NetBSD.
--- vendor/target-lexicon/src/targets.rs.orig 2021-05-03 21:35:46.000000000 +0000
+++ vendor/target-lexicon/src/targets.rs
-@@ -1335,6 +1335,7 @@ mod tests {
+@@ -1357,6 +1357,7 @@ mod tests {
"aarch64-unknown-linux-gnu_ilp32",
"aarch64-unknown-linux-musl",
"aarch64-unknown-netbsd",
@@ -12,7 +12,7 @@ Add aarch64_eb and mipsel for NetBSD.
"aarch64-unknown-none",
"aarch64-unknown-none-softfloat",
"aarch64-unknown-openbsd",
-@@ -1423,6 +1424,7 @@ mod tests {
+@@ -1441,6 +1442,7 @@ mod tests {
"mipsel-unknown-linux-gnu",
"mipsel-unknown-linux-musl",
"mipsel-unknown-linux-uclibc",
@@ -20,3 +20,11 @@ Add aarch64_eb and mipsel 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",
Home |
Main Index |
Thread Index |
Old Index