On 2018 Mar 21 (Wed) at 21:02:51 +0100 (+0100), Landry Breuil wrote: :On Wed, Mar 21, 2018 at 08:45:17PM +0100, Peter Hessler wrote: :> with this patch, security/nss can build on arm64. Only build tested, :> should only affect arm64. :> :> OK? : :NOK - this showed up recently via jbe...@freebsd.org who fixed it :upstream, so i'd rather have the patch that got commited upstream in :https://hg.mozilla.org/projects/nss/rev/be88b7a4fb599a367a13688a9790d3010f3b3692 :/ cf https://bugzilla.mozilla.org/show_bug.cgi?id=1443400 : :Landry :
Even better! A number of the regression tests also PASS. Since I already committed the bogus fix, here's the patches/patch-nss_lib_freebl_blinit_c I'd like to put in instead. OK? === $OpenBSD$ Fix to build on aarch64, buzgilla #1443400 Index: nss/lib/freebl/blinit.c --- nss/lib/freebl/blinit.c.orig +++ nss/lib/freebl/blinit.c @@ -91,23 +91,37 @@ CheckX86CPUSupport() } #endif /* NSS_X86_OR_X64 */ +/* clang-format off */ #if (defined(__aarch64__) || defined(__arm__)) && !defined(__ANDROID__) -#if defined(__GNUC__) && __GNUC__ >= 2 && defined(__ELF__) +#ifndef __has_include +#define __has_include(x) 0 +#endif +#if (__has_include(<sys/auxv.h>) || defined(__linux__)) && \ + defined(__GNUC__) && __GNUC__ >= 2 && defined(__ELF__) #include <sys/auxv.h> extern unsigned long getauxval(unsigned long type) __attribute__((weak)); #else static unsigned long (*getauxval)(unsigned long) = NULL; -#define AT_HWCAP2 -#define AT_HWCAP +#define AT_HWCAP2 0 +#define AT_HWCAP 0 #endif /* defined(__GNUC__) && __GNUC__ >= 2 && defined(__ELF__)*/ #endif /* (defined(__aarch64__) || defined(__arm__)) && !defined(__ANDROID__) */ +/* clang-format on */ #if defined(__aarch64__) && !defined(__ANDROID__) // Defines from hwcap.h in Linux kernel - ARM64 +#ifndef HWCAP_AES #define HWCAP_AES (1 << 3) +#endif +#ifndef HWCAP_PMULL #define HWCAP_PMULL (1 << 4) +#endif +#ifndef HWCAP_SHA1 #define HWCAP_SHA1 (1 << 5) +#endif +#ifndef HWCAP_SHA2 #define HWCAP_SHA2 (1 << 6) +#endif void CheckARMSupport() @@ -131,15 +145,25 @@ CheckARMSupport() /* * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP */ +#ifndef HWCAP_NEON #define HWCAP_NEON (1 << 12) +#endif /* * HWCAP2 flags - for elf_hwcap2 (in kernel) and AT_HWCAP2 */ +#ifndef HWCAP2_AES #define HWCAP2_AES (1 << 0) +#endif +#ifndef HWCAP2_PMULL #define HWCAP2_PMULL (1 << 1) +#endif +#ifndef HWCAP2_SHA1 #define HWCAP2_SHA1 (1 << 2) +#endif +#ifndef HWCAP2_SHA2 #define HWCAP2_SHA2 (1 << 3) +#endif void CheckARMSupport() -- Cynic, n.: One who looks through rose-colored glasses with a jaundiced eye.