From nobody Thu Dec 23 13:20:12 2021 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 53806191610C; Thu, 23 Dec 2021 13:20:23 +0000 (UTC) (envelope-from pkubaj@anongoth.pl) Received: from mail.anongoth.pl (mail.anongoth.pl [46.248.190.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X448 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "anongoth.pl", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JKW5f72mQz4hVg; Thu, 23 Dec 2021 13:20:22 +0000 (UTC) (envelope-from pkubaj@anongoth.pl) Received: from anongoth.pl (unknown [192.168.1.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: pkubaj@anongoth.pl) by mail.anongoth.pl (Postfix) with ESMTPSA id 2441D110AAE; Thu, 23 Dec 2021 14:20:13 +0100 (CET) Date: Thu, 23 Dec 2021 14:20:12 +0100 From: Piotr Kubaj To: Tobias Kortkamp Cc: ports-committers@freebsd.org, dev-commits-ports-all@freebsd.org, dev-commits-ports-main@freebsd.org Subject: Re: git: 96eec29c9aa6 - main - lang/rust: Add riscv64 (riscv64gc-unknown-freebsd) support Message-ID: References: <202112231010.1BNAAf92026504@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Mjg8FM2wKvARLIvN" Content-Disposition: inline In-Reply-To: <202112231010.1BNAAf92026504@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4JKW5f72mQz4hVg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N --Mjg8FM2wKvARLIvN Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Regarding OpenSSL - I just upstreamed BSD-riscv64 target in https://github.= com/openssl/openssl/commit/c2d1ad0e048dd3bfa60e6aa0b5ee343cc6d97a15 and wan= t to backport that to ports, so we may want to switch to that once openssl-= src-rs has it. On 21-12-23 10:10:41, Tobias Kortkamp wrote: > The branch main has been updated by tobik: >=20 > URL: https://cgit.FreeBSD.org/ports/commit/?id=3D96eec29c9aa623f3aef843e2= 38b50329ef386c45 >=20 > commit 96eec29c9aa623f3aef843e238b50329ef386c45 > Author: Tobias Kortkamp > AuthorDate: 2021-11-05 10:25:23 +0000 > Commit: Tobias Kortkamp > CommitDate: 2021-12-23 10:10:16 +0000 >=20 > lang/rust: Add riscv64 (riscv64gc-unknown-freebsd) support > =20 > A kernel with COMPAT_FREEBSD11 is required for now like on all > other FreeBSD archs. FreeBSD11 never had riscv64 support, so > GENERIC does not have it and a kernel rebuild is required. The > same issue existed on powerpc64le. > =20 > The riscv64gc-unknown-freebsd target was upstreamed and will > be part of Rust 1.59.0 (2021-02-24). > =20 > Reviewed by: jrtc27, pkubaj > Differential Revision: https://reviews.freebsd.org/D32881 > --- > Mk/Uses/cargo.mk | 1 + > lang/rust-bootstrap/Makefile | 9 +- > lang/rust/Makefile | 5 +- > lang/rust/distinfo | 6 + > .../riscv64/patch-compiler_rustc__llvm_build.rs | 16 +++ > .../patch-compiler_rustc__target_src_spec_mod.rs | 10 ++ > ..._target_src_spec_riscv64gc__unknown__freebsd.rs | 21 +++ > .../riscv64/patch-library_std_src_os_raw_mod.rs | 22 +++ > ...tes_std__detect_src_detect_os_freebsd_auxvec.rs | 12 ++ > .../files/riscv64/patch-src_bootstrap_bootstrap.py | 11 ++ > .../files/riscv64/patch-src_bootstrap_native.rs | 20 +++ > .../patch-src_doc_rustc_src_platform-support.md | 10 ++ > .../riscv64/patch-vendor_cc-1.0.69_src_lib.rs | 12 ++ > lang/rust/files/riscv64/patch-vendor_cc_src_lib.rs | 12 ++ > ...c_unix_bsd_freebsdlike_freebsd_freebsd11_mod.rs | 12 ++ > ...c_unix_bsd_freebsdlike_freebsd_freebsd12_mod.rs | 12 ++ > ...c_unix_bsd_freebsdlike_freebsd_freebsd13_mod.rs | 12 ++ > ...-0.2.98_src_unix_bsd_freebsdlike_freebsd_mod.rs | 12 ++ > ....98_src_unix_bsd_freebsdlike_freebsd_riscv64.rs | 157 +++++++++++++++= ++++++ > ...c_unix_bsd_freebsdlike_freebsd_freebsd11_mod.rs | 12 ++ > ...c_unix_bsd_freebsdlike_freebsd_freebsd12_mod.rs | 12 ++ > ...c_unix_bsd_freebsdlike_freebsd_freebsd13_mod.rs | 12 ++ > ...or_libc_src_unix_bsd_freebsdlike_freebsd_mod.rs | 12 ++ > ...ibc_src_unix_bsd_freebsdlike_freebsd_riscv64.rs | 157 +++++++++++++++= ++++++ > .../riscv64/patch-vendor_openssl-src_src_lib.rs | 10 ++ > ...vendor_rustc__ap__rustc__target_src_spec_mod.rs | 9 ++ > ..._target_src_spec_riscv64gc__unknown__freebsd.rs | 21 +++ > 27 files changed, 614 insertions(+), 3 deletions(-) >=20 > diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk > index 1636f2da320f..a1508a9831aa 100644 > --- a/Mk/Uses/cargo.mk > +++ b/Mk/Uses/cargo.mk > @@ -113,6 +113,7 @@ CARGO_BUILD_TARGET?=3D ${_CARGO_RUST_ARCH_${ARCH}:U${= ARCH}}-unknown-${OPSYS:tl} > =20 > _CARGO_RUST_ARCH_amd64=3D x86_64 > _CARGO_RUST_ARCH_i386=3D i686 > +_CARGO_RUST_ARCH_riscv64=3D riscv64gc > =20 > # Environment for cargo > # - CARGO_HOME: local cache of the registry index > diff --git a/lang/rust-bootstrap/Makefile b/lang/rust-bootstrap/Makefile > index 4dae6430264f..115fb7fe206c 100644 > --- a/lang/rust-bootstrap/Makefile > +++ b/lang/rust-bootstrap/Makefile > @@ -27,7 +27,7 @@ BUILD_DEPENDS=3D ${FLAVOR:S/_/-/g}-freebsd-sysroot>=3Da= 2021.09.14:devel/freebsd-sysr > rust>=3D${PORTVERSION}:lang/rust > =20 > FLAVORS=3D aarch64 amd64 armv6 armv7 i386 powerpc64_elfv1 powerpc64_elfv= 2 \ > - powerpc64le powerpc > + powerpc64le powerpc riscv64 > FLAVOR?=3D ${FLAVORS:[1]} > =20 > USES=3D cpe ninja:build perl5 python:3.6+,build tar:xz > @@ -51,6 +51,7 @@ _RUST_ARCH_amd64=3D x86_64 > _RUST_ARCH_i386=3D i686 > _RUST_ARCH_powerpc64_elfv1=3D powerpc64 > _RUST_ARCH_powerpc64_elfv2=3D powerpc64 > +_RUST_ARCH_riscv64=3D riscv64gc > _RUST_HOST=3D ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl} > _RUST_TARGET=3D ${_RUST_ARCH_${FLAVOR}:U${FLAVOR}}-unknown-${OPSYS:tl} > _RUST_LLVM_TARGET=3D ${_RUST_LLVM_TARGET_${FLAVOR}} > @@ -63,13 +64,14 @@ _RUST_LLVM_TARGET_powerpc64_elfv1=3D PowerPC > _RUST_LLVM_TARGET_powerpc64_elfv2=3D PowerPC > _RUST_LLVM_TARGET_powerpc64le=3D PowerPC > _RUST_LLVM_TARGET_powerpc=3D PowerPC > +_RUST_LLVM_TARGET_riscv64=3D RISCV > =20 > .include > =20 > .if ${OPSYS} !=3D FreeBSD > IGNORE=3D is only for FreeBSD > .endif > -.if ${FLAVOR} =3D=3D powerpc64le && ${OSVERSION} < 1300116 > +.if (${FLAVOR} =3D=3D powerpc64le || ${FLAVOR} =3D=3D riscv64) && ${OSVE= RSION} < 1300116 > IGNORE=3D will not build on 12.x due to old system > .endif > =20 > @@ -112,6 +114,9 @@ do-configure: > @${ECHO_CMD} '[rust]' >> ${WRKSRC}/config.toml > @${ECHO_CMD} 'channel=3D"stable"' >> ${WRKSRC}/config.toml > @${ECHO_CMD} 'default-linker=3D"${CC}"' >> ${WRKSRC}/config.toml > +.if ${FLAVOR} =3D=3D riscv64 > + @${ECHO_CMD} 'debug=3Dtrue' >> ${WRKSRC}/config.toml > +.endif > @${ECHO_CMD} 'deny-warnings=3Dfalse' >> ${WRKSRC}/config.toml > @${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml > @${ECHO_CMD} 'link-shared=3Dfalse' >> ${WRKSRC}/config.toml > diff --git a/lang/rust/Makefile b/lang/rust/Makefile > index 9b5f0cc0927f..ee8779c2f1e6 100644 > --- a/lang/rust/Makefile > +++ b/lang/rust/Makefile > @@ -26,7 +26,7 @@ LICENSE_FILE_MIT=3D ${WRKSRC}/LICENSE-MIT > =20 > IGNORE_FreeBSD_12_powerpc=3D is missing a bootstrap for FreeBSD 12.x pow= erpc > ONLY_FOR_ARCHS?=3D aarch64 amd64 armv6 armv7 i386 powerpc64 powerpc64le \ > - powerpc > + powerpc riscv64 > ONLY_FOR_ARCHS_REASON?=3D requires prebuilt bootstrap compiler > =20 > BUILD_DEPENDS=3D cmake:devel/cmake > @@ -70,6 +70,8 @@ WASM_VARS_OFF=3D _RUST_BUILD_WASM=3Dfalse > # See WRKSRC/src/stage0.json for the date and version values > BOOTSTRAPS_DATE?=3D 2021-10-21 > RUST_BOOTSTRAP_VERSION?=3D 1.56.0 > +BOOTSTRAPS_DATE_riscv64=3D 2021-12-02 > +RUST_BOOTSTRAP_VERSION_riscv64=3D 1.57.0 > =20 > BOOTSTRAPS_SUFFIX?=3D ${BOOTSTRAPS_SUFFIX_${ARCH}} > BOOTSTRAPS_SUFFIX_powerpc64?=3D -${PPC_ABI:tl} > @@ -79,6 +81,7 @@ CARGO_VENDOR_DIR?=3D ${WRKSRC}/vendor > # Rust's target arch string might be different from *BSD arch strings > _RUST_ARCH_amd64=3D x86_64 > _RUST_ARCH_i386=3D i686 > +_RUST_ARCH_riscv64=3D riscv64gc > _RUST_TARGET=3D ${_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl} > _RUST_TARGETS=3D ${_RUST_TARGET} > _RUST_TOOLS=3D analysis cargo clippy rustfmt > diff --git a/lang/rust/distinfo b/lang/rust/distinfo > index ec6a829367ad..c698f325589e 100644 > --- a/lang/rust/distinfo > +++ b/lang/rust/distinfo > @@ -49,6 +49,12 @@ SHA256 (rust/2021-10-21/rust-std-1.56.0-powerpc64le-un= known-freebsd.tar.xz) =3D d7 > SIZE (rust/2021-10-21/rust-std-1.56.0-powerpc64le-unknown-freebsd.tar.xz= ) =3D 18805860 > SHA256 (rust/2021-10-21/cargo-1.56.0-powerpc64le-unknown-freebsd.tar.xz)= =3D c29c558c07d09e56c0288d2c9528b63311072ca491a047b9588ea3320d1699bb > SIZE (rust/2021-10-21/cargo-1.56.0-powerpc64le-unknown-freebsd.tar.xz) = =3D 5046108 > +SHA256 (rust/2021-12-02/rustc-1.57.0-riscv64gc-unknown-freebsd.tar.xz) = =3D 7831ebf7d9b9c579d3e16e1b7b556a793d63a62f36636fba3b63ef2ed13c6872 > +SIZE (rust/2021-12-02/rustc-1.57.0-riscv64gc-unknown-freebsd.tar.xz) =3D= 141961976 > +SHA256 (rust/2021-12-02/rust-std-1.57.0-riscv64gc-unknown-freebsd.tar.xz= ) =3D 3068b2f74537e5efcd293ebae7ce0e16bff92603cbc3ac5201ba3bb8e9ebe4ef > +SIZE (rust/2021-12-02/rust-std-1.57.0-riscv64gc-unknown-freebsd.tar.xz) = =3D 27221940 > +SHA256 (rust/2021-12-02/cargo-1.57.0-riscv64gc-unknown-freebsd.tar.xz) = =3D c88fb84cd53349fcac5516f79b88f8b23ebdcbac40408719a112ef095068a95d > +SIZE (rust/2021-12-02/cargo-1.57.0-riscv64gc-unknown-freebsd.tar.xz) =3D= 24413628 > SHA256 (rust/2021-10-21/rustc-1.56.0-powerpc64-unknown-freebsd-elfv2.tar= =2Exz) =3D b5f715c8b66e53ae3ef4a0dcd6fd70b033595316ded47c5b733c34408e8bf1e5 > SIZE (rust/2021-10-21/rustc-1.56.0-powerpc64-unknown-freebsd-elfv2.tar.x= z) =3D 48308540 > SHA256 (rust/2021-10-21/rust-std-1.56.0-powerpc64-unknown-freebsd-elfv2.= tar.xz) =3D 012200453f449bd1a5b7b43ccafe11fa6169b6bf3c009f5de689740a43bd39ec > diff --git a/lang/rust/files/riscv64/patch-compiler_rustc__llvm_build.rs = b/lang/rust/files/riscv64/patch-compiler_rustc__llvm_build.rs > new file mode 100644 > index 000000000000..1786f3e285df > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-compiler_rustc__llvm_build.rs > @@ -0,0 +1,16 @@ > +--- compiler/rustc_llvm/build.rs.orig 2021-11-29 19:27:11 UTC > ++++ compiler/rustc_llvm/build.rs > +@@ -276,8 +276,11 @@ fn main() { > + "stdc++" > + }; > +=20 > +- // RISC-V requires libatomic for sub-word atomic operations > +- if target.starts_with("riscv") { > ++ // RISC-V GCC erroneously requires libatomic for sub-word > ++ // atomic operations. FreeBSD uses Clang as its system > ++ // compiler and provides no libatomic in its base system so > ++ // does not want this. > ++ if !target.contains("freebsd") && target.starts_with("riscv") { > + println!("cargo:rustc-link-lib=3Datomic"); > + } > +=20 > diff --git a/lang/rust/files/riscv64/patch-compiler_rustc__target_src_spe= c_mod.rs b/lang/rust/files/riscv64/patch-compiler_rustc__target_src_spec_mo= d.rs > new file mode 100644 > index 000000000000..f08735462131 > --- /dev/null > +++ b/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), > +=20 > + ("x86_64-unknown-dragonfly", x86_64_unknown_dragonfly), > diff --git a/lang/rust/files/riscv64/patch-compiler_rustc__target_src_spe= c_riscv64gc__unknown__freebsd.rs b/lang/rust/files/riscv64/patch-compiler_r= ustc__target_src_spec_riscv64gc__unknown__freebsd.rs > new file mode 100644 > index 000000000000..9dcbb17ab3c0 > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-compiler_rustc__target_src_spec_riscv= 64gc__unknown__freebsd.rs > @@ -0,0 +1,21 @@ > +--- compiler/rustc_target/src/spec/riscv64gc_unknown_freebsd.rs.orig 202= 1-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() > ++ }, > ++ } > ++} > diff --git a/lang/rust/files/riscv64/patch-library_std_src_os_raw_mod.rs = b/lang/rust/files/riscv64/patch-library_std_src_os_raw_mod.rs > new file mode 100644 > index 000000000000..e880f73fd205 > --- /dev/null > +++ b/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 =3D u8, NonZero_c_char= =3D > + target_arch =3D "aarch64", > + target_arch =3D "arm", > + target_arch =3D "powerpc", > +- target_arch =3D "powerpc64" > ++ target_arch =3D "powerpc64", > ++ target_arch =3D "riscv64" > + ) > + ), > + all( > +@@ -110,7 +111,8 @@ type_alias! { "char.md", c_char =3D i8, NonZero_c_ch= ar =3D > + target_arch =3D "aarch64", > + target_arch =3D "arm", > + target_arch =3D "powerpc", > +- target_arch =3D "powerpc64" > ++ target_arch =3D "powerpc64", > ++ target_arch =3D "riscv64" > + ) > + ), > + all( > diff --git a/lang/rust/files/riscv64/patch-library_stdarch_crates_std__de= tect_src_detect_os_freebsd_auxvec.rs b/lang/rust/files/riscv64/patch-librar= y_stdarch_crates_std__detect_src_detect_os_freebsd_auxvec.rs > new file mode 100644 > index 000000000000..d2df5bd0056f > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-library_stdarch_crates_std__detect_sr= c_detect_os_freebsd_auxvec.rs > @@ -0,0 +1,12 @@ > +--- library/stdarch/crates/std_detect/src/detect/os/freebsd/auxvec.rs.or= ig 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 =3D "aarch64", > + target_arch =3D "arm", > +- target_arch =3D "powerpc64" > ++ target_arch =3D "powerpc64", > ++ target_arch =3D "riscv64" > + ), > + allow(dead_code) > + )] > diff --git a/lang/rust/files/riscv64/patch-src_bootstrap_bootstrap.py b/l= ang/rust/files/riscv64/patch-src_bootstrap_bootstrap.py > new file mode 100644 > index 000000000000..d384c0990ca5 > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-src_bootstrap_bootstrap.py > @@ -0,0 +1,11 @@ > +--- src/bootstrap/bootstrap.py.orig 2021-11-11 14:21:03 UTC > ++++ src/bootstrap/bootstrap.py > +@@ -283,7 +283,7 @@ def default_build_triple(verbose): > + err =3D "unknown OS type: {}".format(ostype) > + sys.exit(err) > +=20 > +- if cputype =3D=3D 'powerpc' and ostype =3D=3D 'unknown-freebsd': > ++ if cputype in ['powerpc', 'riscv'] and ostype =3D=3D 'unknown-freeb= sd': > + cputype =3D subprocess.check_output( > + ['uname', '-p']).strip().decode(default_encoding) > + cputype_mapper =3D { > diff --git a/lang/rust/files/riscv64/patch-src_bootstrap_native.rs b/lang= /rust/files/riscv64/patch-src_bootstrap_native.rs > new file mode 100644 > index 000000000000..df56a7f09589 > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-src_bootstrap_native.rs > @@ -0,0 +1,20 @@ > +--- src/bootstrap/native.rs.orig 2021-11-29 19:27:11 UTC > ++++ src/bootstrap/native.rs > +@@ -248,9 +248,14 @@ impl Step for Llvm { > + } > + } > +=20 > +- if target.starts_with("riscv") { > +- // In RISC-V, using C++ atomics require linking to `libatom= ic` but the LLVM build > +- // system check cannot detect this. Therefore it is set man= ually here. > ++ if !target.contains("freebsd") && target.starts_with("riscv") { > ++ // RISC-V GCC erroneously requires linking against > ++ // `libatomic` when using 1-byte and 2-byte C++ > ++ // atomics but the LLVM build system check cannot > ++ // detect this. Therefore it is set manually here. > ++ // FreeBSD uses Clang as its system compiler and > ++ // provides no libatomic in its base system so does > ++ // not want this. > + if !builder.config.llvm_tools_enabled { > + cfg.define("CMAKE_EXE_LINKER_FLAGS", "-latomic"); > + } else { > diff --git a/lang/rust/files/riscv64/patch-src_doc_rustc_src_platform-sup= port.md b/lang/rust/files/riscv64/patch-src_doc_rustc_src_platform-support.= md > new file mode 100644 > index 000000000000..9f82379f9187 > --- /dev/null > +++ b/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` | =E2=9C=93 | | RISC-V ESP-IDF > ++`riscv64gc-unknown-freebsd` | | | RISC-V FreeBSD > + `riscv64gc-unknown-linux-musl` | | | RISC-V Linux (kernel 4.20, mus= l 1.2.0) > + `s390x-unknown-linux-musl` | | | S390x Linux (kernel 2.6.32, MUSL) > + `sparc-unknown-linux-gnu` | =E2=9C=93 | | 32-bit SPARC Linux > diff --git a/lang/rust/files/riscv64/patch-vendor_cc-1.0.69_src_lib.rs b/= lang/rust/files/riscv64/patch-vendor_cc-1.0.69_src_lib.rs > new file mode 100644 > index 000000000000..be6399810851 > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_cc-1.0.69_src_lib.rs > @@ -0,0 +1,12 @@ > +--- vendor/cc-1.0.69/src/lib.rs.orig 2021-10-18 11:05:53 UTC > ++++ vendor/cc-1.0.69/src/lib.rs > +@@ -1700,6 +1700,9 @@ impl Build { > + if target.contains("linux") && arch.starts_with= ("64") { > + cmd.args.push(("-march=3Drv64gc").into()); > + cmd.args.push("-mabi=3Dlp64d".into()); > ++ } else if target.contains("freebsd") && arch.st= arts_with("64") { > ++ cmd.args.push(("-march=3Drv64gc").into()); > ++ cmd.args.push("-mabi=3Dlp64d".into()); > + } else if target.contains("linux") && arch.star= ts_with("32") { > + cmd.args.push(("-march=3Drv32gc").into()); > + cmd.args.push("-mabi=3Dilp32d".into()); > diff --git a/lang/rust/files/riscv64/patch-vendor_cc_src_lib.rs b/lang/ru= st/files/riscv64/patch-vendor_cc_src_lib.rs > new file mode 100644 > index 000000000000..1c2974574031 > --- /dev/null > +++ b/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=3Drv64gc").into()); > + cmd.args.push("-mabi=3Dlp64d".into()); > ++ } else if target.contains("freebsd") && arch.st= arts_with("64") { > ++ cmd.args.push(("-march=3Drv64gc").into()); > ++ cmd.args.push("-mabi=3Dlp64d".into()); > + } else if target.contains("linux") && arch.star= ts_with("32") { > + cmd.args.push(("-march=3Drv32gc").into()); > + cmd.args.push("-mabi=3Dilp32d".into()); > diff --git a/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bs= d_freebsdlike_freebsd_freebsd11_mod.rs b/lang/rust/files/riscv64/patch-vend= or_libc-0.2.98_src_unix_bsd_freebsdlike_freebsd_freebsd11_mod.rs > new file mode 100644 > index 000000000000..04aef529ce69 > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freeb= sdlike_freebsd_freebsd11_mod.rs > @@ -0,0 +1,12 @@ > +--- vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs= =2Eorig 2021-11-29 20:27:33 UTC > ++++ vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs > +@@ -217,7 +217,8 @@ extern "C" { > +=20 > + cfg_if! { > + if #[cfg(any(target_arch =3D "x86_64", > +- target_arch =3D "aarch64"))] { > ++ target_arch =3D "aarch64", > ++ target_arch =3D "riscv64"))] { > + mod b64; > + pub use self::b64::*; > + } > diff --git a/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bs= d_freebsdlike_freebsd_freebsd12_mod.rs b/lang/rust/files/riscv64/patch-vend= or_libc-0.2.98_src_unix_bsd_freebsdlike_freebsd_freebsd12_mod.rs > new file mode 100644 > index 000000000000..e9a428f19c59 > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freeb= sdlike_freebsd_freebsd12_mod.rs > @@ -0,0 +1,12 @@ > +--- vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs= =2Eorig 2021-11-29 20:27:33 UTC > ++++ vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs > +@@ -235,7 +235,8 @@ extern "C" { > +=20 > + cfg_if! { > + if #[cfg(any(target_arch =3D "x86_64", > +- target_arch =3D "aarch64"))] { > ++ target_arch =3D "aarch64", > ++ target_arch =3D "riscv64"))] { > + mod b64; > + pub use self::b64::*; > + } > diff --git a/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bs= d_freebsdlike_freebsd_freebsd13_mod.rs b/lang/rust/files/riscv64/patch-vend= or_libc-0.2.98_src_unix_bsd_freebsdlike_freebsd_freebsd13_mod.rs > new file mode 100644 > index 000000000000..fbfa6662aabb > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freeb= sdlike_freebsd_freebsd13_mod.rs > @@ -0,0 +1,12 @@ > +--- vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs= =2Eorig 2021-11-29 20:27:33 UTC > ++++ vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs > +@@ -240,7 +240,8 @@ extern "C" { > +=20 > + cfg_if! { > + if #[cfg(any(target_arch =3D "x86_64", > +- target_arch =3D "aarch64"))] { > ++ target_arch =3D "aarch64", > ++ target_arch =3D "riscv64"))] { > + mod b64; > + pub use self::b64::*; > + } > diff --git a/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bs= d_freebsdlike_freebsd_mod.rs b/lang/rust/files/riscv64/patch-vendor_libc-0.= 2.98_src_unix_bsd_freebsdlike_freebsd_mod.rs > new file mode 100644 > index 000000000000..864d0669534c > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freeb= sdlike_freebsd_mod.rs > @@ -0,0 +1,12 @@ > +--- vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/mod.rs.orig 2021= -11-29 20:27:33 UTC > ++++ vendor/libc-0.2.98/src/unix/bsd/freebsdlike/freebsd/mod.rs > +@@ -1749,6 +1749,9 @@ cfg_if! { > + } else if #[cfg(target_arch =3D "powerpc")] { > + mod powerpc; > + pub use self::powerpc::*; > ++ } else if #[cfg(target_arch =3D "riscv64")] { > ++ mod riscv64; > ++ pub use self::riscv64::*; > + } else { > + // Unknown target_arch > + } > diff --git a/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bs= d_freebsdlike_freebsd_riscv64.rs b/lang/rust/files/riscv64/patch-vendor_lib= c-0.2.98_src_unix_bsd_freebsdlike_freebsd_riscv64.rs > new file mode 100644 > index 000000000000..d4fddf2844a2 > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_libc-0.2.98_src_unix_bsd_freeb= sdlike_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 =3D u8; > ++pub type c_long =3D i64; > ++pub type c_ulong =3D u64; > ++pub type wchar_t =3D ::c_int; > ++pub type time_t =3D i64; > ++pub type suseconds_t =3D ::c_long; > ++pub type register_t =3D 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 =3D ::mem::size_of::<::c_longlong>= () - 1; > ++ } else { > ++ #[doc(hidden)] > ++ pub const _ALIGNBYTES: usize =3D 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 =3D "extra_traits")] { > ++ impl PartialEq for gpregs { > ++ fn eq(&self, other: &gpregs) -> bool { > ++ self.gp_ra =3D=3D other.gp_ra && > ++ self.gp_sp =3D=3D other.gp_sp && > ++ self.gp_gp =3D=3D other.gp_gp && > ++ self.gp_tp =3D=3D other.gp_tp && > ++ self.gp_t.iter().zip(other.gp_t.iter()).all(|(a, b)| a = =3D=3D b) && > ++ self.gp_s.iter().zip(other.gp_s.iter()).all(|(a, b)| a = =3D=3D b) && > ++ self.gp_a.iter().zip(other.gp_a.iter()).all(|(a, b)| a = =3D=3D b) && > ++ self.gp_sepc =3D=3D other.gp_sepc && > ++ self.gp_sstatus =3D=3D 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(&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 =3D=3D other.fp_x && > ++ self.fp_fcsr =3D=3D other.fp_fcsr && > ++ self.fp_flags =3D=3D other.fp_flags && > ++ self.fp_pad =3D=3D 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(&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 =3D=3D other.mc_gpregs && > ++ self.mc_fpregs =3D=3D other.mc_fpregs && > ++ self.mc_flags =3D=3D other.mc_flags && > ++ self.mc_pad =3D=3D other.mc_pad && > ++ self.mc_spare.iter().zip(other.mc_spare.iter()).all(|(a= , b)| a =3D=3D 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(&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 =3D 0x00080000; > ++pub const MINSIGSTKSZ: ::size_t =3D 4096; // 1024 * 4 > diff --git a/lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freeb= sdlike_freebsd_freebsd11_mod.rs b/lang/rust/files/riscv64/patch-vendor_libc= _src_unix_bsd_freebsdlike_freebsd_freebsd11_mod.rs > new file mode 100644 > index 000000000000..017c18db6f9c > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freebsdlike_= freebsd_freebsd11_mod.rs > @@ -0,0 +1,12 @@ > +--- vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs.orig 2= 021-11-29 20:27:33 UTC > ++++ vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs > +@@ -217,7 +217,8 @@ extern "C" { > +=20 > + cfg_if! { > + if #[cfg(any(target_arch =3D "x86_64", > +- target_arch =3D "aarch64"))] { > ++ target_arch =3D "aarch64", > ++ target_arch =3D "riscv64"))] { > + mod b64; > + pub use self::b64::*; > + } > diff --git a/lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freeb= sdlike_freebsd_freebsd12_mod.rs b/lang/rust/files/riscv64/patch-vendor_libc= _src_unix_bsd_freebsdlike_freebsd_freebsd12_mod.rs > new file mode 100644 > index 000000000000..599ba3d18247 > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freebsdlike_= freebsd_freebsd12_mod.rs > @@ -0,0 +1,12 @@ > +--- vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs.orig 2= 021-11-29 20:27:33 UTC > ++++ vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs > +@@ -241,7 +241,8 @@ extern "C" { > +=20 > + cfg_if! { > + if #[cfg(any(target_arch =3D "x86_64", > +- target_arch =3D "aarch64"))] { > ++ target_arch =3D "aarch64", > ++ target_arch =3D "riscv64"))] { > + mod b64; > + pub use self::b64::*; > + } > diff --git a/lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freeb= sdlike_freebsd_freebsd13_mod.rs b/lang/rust/files/riscv64/patch-vendor_libc= _src_unix_bsd_freebsdlike_freebsd_freebsd13_mod.rs > new file mode 100644 > index 000000000000..4098c94249cc > --- /dev/null > +++ b/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 2= 021-11-29 20:27:33 UTC > ++++ vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs > +@@ -271,7 +271,8 @@ extern "C" { > +=20 > + cfg_if! { > + if #[cfg(any(target_arch =3D "x86_64", > +- target_arch =3D "aarch64"))] { > ++ target_arch =3D "aarch64", > ++ target_arch =3D "riscv64"))] { > + mod b64; > + pub use self::b64::*; > + } > diff --git a/lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freeb= sdlike_freebsd_mod.rs b/lang/rust/files/riscv64/patch-vendor_libc_src_unix_= bsd_freebsdlike_freebsd_mod.rs > new file mode 100644 > index 000000000000..a99c851e9422 > --- /dev/null > +++ b/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-29 = 20:27:33 UTC > ++++ vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs > +@@ -2021,6 +2021,9 @@ cfg_if! { > + } else if #[cfg(target_arch =3D "powerpc")] { > + mod powerpc; > + pub use self::powerpc::*; > ++ } else if #[cfg(target_arch =3D "riscv64")] { > ++ mod riscv64; > ++ pub use self::riscv64::*; > + } else { > + // Unknown target_arch > + } > diff --git a/lang/rust/files/riscv64/patch-vendor_libc_src_unix_bsd_freeb= sdlike_freebsd_riscv64.rs b/lang/rust/files/riscv64/patch-vendor_libc_src_u= nix_bsd_freebsdlike_freebsd_riscv64.rs > new file mode 100644 > index 000000000000..103a066a39af > --- /dev/null > +++ b/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 =3D u8; > ++pub type c_long =3D i64; > ++pub type c_ulong =3D u64; > ++pub type wchar_t =3D ::c_int; > ++pub type time_t =3D i64; > ++pub type suseconds_t =3D ::c_long; > ++pub type register_t =3D 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 =3D ::mem::size_of::<::c_longlong>= () - 1; > ++ } else { > ++ #[doc(hidden)] > ++ pub const _ALIGNBYTES: usize =3D 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 =3D "extra_traits")] { > ++ impl PartialEq for gpregs { > ++ fn eq(&self, other: &gpregs) -> bool { > ++ self.gp_ra =3D=3D other.gp_ra && > ++ self.gp_sp =3D=3D other.gp_sp && > ++ self.gp_gp =3D=3D other.gp_gp && > ++ self.gp_tp =3D=3D other.gp_tp && > ++ self.gp_t.iter().zip(other.gp_t.iter()).all(|(a, b)| a = =3D=3D b) && > ++ self.gp_s.iter().zip(other.gp_s.iter()).all(|(a, b)| a = =3D=3D b) && > ++ self.gp_a.iter().zip(other.gp_a.iter()).all(|(a, b)| a = =3D=3D b) && > ++ self.gp_sepc =3D=3D other.gp_sepc && > ++ self.gp_sstatus =3D=3D 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(&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 =3D=3D other.fp_x && > ++ self.fp_fcsr =3D=3D other.fp_fcsr && > ++ self.fp_flags =3D=3D other.fp_flags && > ++ self.fp_pad =3D=3D 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(&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 =3D=3D other.mc_gpregs && > ++ self.mc_fpregs =3D=3D other.mc_fpregs && > ++ self.mc_flags =3D=3D other.mc_flags && > ++ self.mc_pad =3D=3D other.mc_pad && > ++ self.mc_spare.iter().zip(other.mc_spare.iter()).all(|(a= , b)| a =3D=3D 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(&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 =3D 0x00080000; > ++pub const MINSIGSTKSZ: ::size_t =3D 4096; // 1024 * 4 > diff --git a/lang/rust/files/riscv64/patch-vendor_openssl-src_src_lib.rs = b/lang/rust/files/riscv64/patch-vendor_openssl-src_src_lib.rs > new file mode 100644 > index 000000000000..3171b5769f1a > --- /dev/null > +++ b/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" =3D> "BSD-generic64", > + "powerpc64le-unknown-linux-gnu" =3D> "linux-ppc64le", > + "powerpc64le-unknown-linux-musl" =3D> "linux-ppc64le", > ++ "riscv64gc-unknown-freebsd" =3D> "BSD-generic64", > + "riscv64gc-unknown-linux-gnu" =3D> "linux-generic64", > + "s390x-unknown-linux-gnu" =3D> "linux64-s390x", > + "s390x-unknown-linux-musl" =3D> "linux64-s390x", > diff --git a/lang/rust/files/riscv64/patch-vendor_rustc__ap__rustc__targe= t_src_spec_mod.rs b/lang/rust/files/riscv64/patch-vendor_rustc__ap__rustc__= target_src_spec_mod.rs > new file mode 100644 > index 000000000000..9e0858752a7f > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_rustc__ap__rustc__target_src_s= pec_mod.rs > @@ -0,0 +1,9 @@ > +--- vendor/rustc-ap-rustc_target/src/spec/mod.rs.orig 2021-11-04 11:23:5= 0 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), > +=20 > + ("x86_64-unknown-dragonfly", x86_64_unknown_dragonfly), > diff --git a/lang/rust/files/riscv64/patch-vendor_rustc__ap__rustc__targe= t_src_spec_riscv64gc__unknown__freebsd.rs b/lang/rust/files/riscv64/patch-v= endor_rustc__ap__rustc__target_src_spec_riscv64gc__unknown__freebsd.rs > new file mode 100644 > index 000000000000..5faf5e2aacf8 > --- /dev/null > +++ b/lang/rust/files/riscv64/patch-vendor_rustc__ap__rustc__target_src_s= pec_riscv64gc__unknown__freebsd.rs > @@ -0,0 +1,21 @@ > +--- vendor/rustc-ap-rustc_target/src/spec/riscv64gc_unknown_freebsd.rs.o= rig 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() > ++ }, > ++ } > ++} --Mjg8FM2wKvARLIvN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEycyIeNkkgohzsoorelmbhSCDnJ0FAmHEd4wACgkQelmbhSCD nJ3FsRAAo9qoyTdoJjQNGJbVrkkSP3g9pDh7HnURrYACei1gE2e3a54tN/s1iHOV cP/HGNQKG+m+vuC+EaoqvVn7XcC+Pmnhv4RfNr9yKdLmNFI3G6gz5puaxNVRRFkC H/QloJQzKQMYoiNILM/slEVgTISva769hO7tZfkmGLgd31eUZxD+rGd0cH0e7OsE UpoGkB4wPF1W4irwZVWyy2hbitKz8F++hIN4rpXjnIU5EN3ip2z7otKmr1Ge6Nfc ud1AmmEXZUV6ofrLaqGOMcbEwxIJX3Yqs1s66aZ/vs0/t2KzEDliqJ6A3empKQSR iLsMuomL8XI+Zg5Gu3daiQ64D4e56hBi2DO9GVEAhtd5918Kq6+95VbRMmYYXEJW b9+egwZSooNwQOc5hMN/xbN9+LSscwpPCowy/69MM0xLXn4boW34i7wmfgJtvaJb xOe0pnNAtg6nf0lQn5fEFD9l85W9snXDzGJS11QFY+9RpNFuuURK6BJw8WPhRFgh 7oZPV+5wQV9uG28XPTGesG26TtXCTlL8WyEp9NZjP0nx9u72a9mMxR0J+qDXcQr7 5zimNl2nwStX62MAr2RWJuTW88mZyZ+s+YPydbOh67RLArzWhJMQyMO4rbcuQcFV VKyJLdDIooVIwil0edU78ApSMlv0S48DSFhfjgkmmt2HSyXBgFI= =kliU -----END PGP SIGNATURE----- --Mjg8FM2wKvARLIvN--