From owner-dev-commits-ports-main@freebsd.org Sat Sep 25 16:49:38 2021 Return-Path: Delivered-To: dev-commits-ports-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 175036AC73F; Sat, 25 Sep 2021 16:49:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HGvy96zn6z4qMV; Sat, 25 Sep 2021 16:49:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0AAA5A70; Sat, 25 Sep 2021 16:49:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18PGnbw3059377; Sat, 25 Sep 2021 16:49:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18PGnb0G059376; Sat, 25 Sep 2021 16:49:37 GMT (envelope-from git) Date: Sat, 25 Sep 2021 16:49:37 GMT Message-Id: <202109251649.18PGnb0G059376@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Mikael Urankar Subject: git: cb03ad805820 - main - security/rustscan: Fix build on aarch64. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mikael X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb03ad805820836bc7d19d7131ae68763b5edfcd Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the main branch of the FreeBSD ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2021 16:49:38 -0000 The branch main has been updated by mikael: URL: https://cgit.FreeBSD.org/ports/commit/?id=cb03ad805820836bc7d19d7131ae68763b5edfcd commit cb03ad805820836bc7d19d7131ae68763b5edfcd Author: Mikael Urankar AuthorDate: 2021-09-25 16:42:01 +0000 Commit: Mikael Urankar CommitDate: 2021-09-25 16:49:34 +0000 security/rustscan: Fix build on aarch64. --- .../rustscan/files/patch-cargo-crates_ring-0.16.15 | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/security/rustscan/files/patch-cargo-crates_ring-0.16.15 b/security/rustscan/files/patch-cargo-crates_ring-0.16.15 new file mode 100644 index 000000000000..4aaee12d64c2 --- /dev/null +++ b/security/rustscan/files/patch-cargo-crates_ring-0.16.15 @@ -0,0 +1,127 @@ +--- cargo-crates/ring-0.16.15/Cargo.toml.orig 2020-06-16 23:27:06 UTC ++++ cargo-crates/ring-0.16.15/Cargo.toml +@@ -70,7 +70,7 @@ version = "1.3.1" + features = ["std"] + optional = true + default-features = false +-[target."cfg(any(target_os = \"android\", target_os = \"linux\"))".dependencies.libc] ++[target."cfg(any(target_os = \"android\", target_os = \"freebsd\", target_os = \"linux\"))".dependencies.libc] + version = "0.2.69" + default-features = false + [target."cfg(any(unix, windows))".dev-dependencies.libc] +--- cargo-crates/ring-0.16.15/src/cpu.rs.orig 2020-06-10 20:45:54 UTC ++++ cargo-crates/ring-0.16.15/src/cpu.rs +@@ -60,6 +60,11 @@ pub(crate) fn features() -> Features { + { + arm::fuchsia_setup(); + } ++ ++ #[cfg(all(target_os = "freebsd", any(target_arch = "aarch64", target_arch = "arm")))] ++ { ++ arm::freebsd_setup(); ++ } + }); + } + +@@ -168,6 +173,83 @@ pub(crate) mod arm { + } + } + ++ #[cfg(all(target_os = "freebsd", any(target_arch = "aarch64", target_arch = "arm")))] ++ pub fn freebsd_setup() { ++ extern crate std; ++ use libc::{c_int, c_ulong, c_void}; ++ ++ extern "C" { ++ fn elf_aux_info(aux: c_int, buf: *mut c_void, buflen: c_int) -> c_int; ++ } ++ ++ const AT_HWCAP: c_int = 25; ++ ++ #[cfg(target_arch = "aarch64")] ++ const HWCAP_NEON: c_ulong = 1 << 1; ++ ++ #[cfg(target_arch = "arm")] ++ const HWCAP_NEON: c_ulong = 1 << 12; ++ ++ let caps: c_ulong = 0; ++ let buffer : *mut c_void = { let t: *const c_ulong = ∩︀ t} as *mut c_void; ++ ++ unsafe { ++ let _ret = elf_aux_info( ++ AT_HWCAP, ++ buffer, ++ std::mem::size_of_val(&caps) as i32 ++ ); ++ } ++ ++ // We assume NEON is available on AARCH64 because it is a required ++ // feature. ++ #[cfg(target_arch = "aarch64")] ++ debug_assert!(caps & HWCAP_NEON == HWCAP_NEON); ++ ++ // OpenSSL and BoringSSL don't enable any other features if NEON isn't ++ // available. ++ if caps & HWCAP_NEON == HWCAP_NEON { ++ let mut features = NEON.mask; ++ ++ #[cfg(target_arch = "aarch64")] ++ const OFFSET: c_ulong = 3; ++ ++ #[cfg(target_arch = "arm")] ++ const OFFSET: c_ulong = 0; ++ #[cfg(target_arch = "arm")] ++ const AT_HWCAP2: c_int = 26; ++ #[cfg(target_arch = "arm")] ++ let caps: c_ulong = 0; ++ #[cfg(target_arch = "arm")] ++ let buffer : *mut c_void = { let t: *const c_ulong = ∩︀ t} as *mut c_void; ++ ++ #[cfg(target_arch = "arm")] ++ unsafe { ++ let _ret = elf_aux_info( ++ AT_HWCAP2, ++ buffer, ++ std::mem::size_of_val(&caps) as i32 ++ ); ++ }; ++ ++ const HWCAP_AES: c_ulong = 1 << 0 + OFFSET; ++ const HWCAP_PMULL: c_ulong = 1 << 1 + OFFSET; ++ const HWCAP_SHA2: c_ulong = 1 << 3 + OFFSET; ++ ++ if caps & HWCAP_AES == HWCAP_AES { ++ features |= AES.mask; ++ } ++ if caps & HWCAP_PMULL == HWCAP_PMULL { ++ features |= PMULL.mask; ++ } ++ if caps & HWCAP_SHA2 == HWCAP_SHA2 { ++ features |= 1 << 4; ++ } ++ ++ unsafe { GFp_armcap_P = features }; ++ } ++ } ++ + #[cfg(not(target_arch = "wasm32"))] + pub(crate) struct Feature { + #[cfg_attr( +@@ -193,7 +275,7 @@ pub(crate) mod arm { + } + + #[cfg(all( +- any(target_os = "android", target_os = "linux", target_os = "fuchsia"), ++ any(target_os = "android", target_os = "linux", target_os = "fuchsia", target_os = "freebsd"), + any(target_arch = "arm", target_arch = "aarch64") + ))] + { +@@ -239,7 +321,7 @@ pub(crate) mod arm { + }; + + #[cfg(all( +- any(target_os = "android", target_os = "linux", target_os = "fuchsia"), ++ any(target_os = "android", target_os = "linux", target_os = "fuchsia", target_os = "freebsd"), + any(target_arch = "arm", target_arch = "aarch64") + ))] + extern "C" {