From 14d150b63c0e3276c261a4261d236a8e6886f33e Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 14 Oct 2017 22:01:56 +0000 Subject: [PATCH] benchmarks/fio: unbreak on aarch64 PR: 223016 Approved by: ??? MFH: 2017Q4 (ports-secteam blanket) --- benchmarks/fio/Makefile | 1 - benchmarks/fio/files/patch-crc_crc32c-arm64.c | 45 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 benchmarks/fio/files/patch-crc_crc32c-arm64.c diff --git a/benchmarks/fio/Makefile b/benchmarks/fio/Makefile index 4f4ac7670f88..64edf3232da3 100644 --- a/benchmarks/fio/Makefile +++ b/benchmarks/fio/Makefile @@ -18,7 +18,6 @@ GNUPLOT_DESC= Support for plotting graphs GNUPLOT_BUILD_DEPENDS= ${LOCALBASE}/bin/gnuplot:math/gnuplot -BROKEN_aarch64= Fails to compile: error: sys/auxv.h file not found BROKEN_armv6= Fails to compile: error: use of undeclared identifier nop BROKEN_powerpc64= Fails to compile: verify.c:1574: undefined reference to bswap64 diff --git a/benchmarks/fio/files/patch-crc_crc32c-arm64.c b/benchmarks/fio/files/patch-crc_crc32c-arm64.c new file mode 100644 index 000000000000..4662468d84aa --- /dev/null +++ b/benchmarks/fio/files/patch-crc_crc32c-arm64.c @@ -0,0 +1,45 @@ +--- crc/crc32c-arm64.c.orig 2017-09-28 10:23:20 UTC ++++ crc/crc32c-arm64.c +@@ -23,7 +23,42 @@ bool crc32c_arm64_available = false; + + #ifdef ARCH_HAVE_ARM64_CRC_CRYPTO + ++#if __has_include() + #include ++#elif defined(__FreeBSD__) ++#include ++#include ++#include ++#include ++#include ++ ++#ifndef AT_HWCAP ++#define AT_HWCAP 25 ++#endif ++ ++static unsigned long getauxval(unsigned long type) { ++ Elf_Auxinfo auxv[AT_COUNT]; ++ size_t len = sizeof(auxv); ++ int mib[] = { ++ CTL_KERN, ++ KERN_PROC, ++ KERN_PROC_AUXV, ++ getpid(), ++ }; ++ ++ if (sysctl(mib, nitems(mib), auxv, &len, NULL, 0) != -1) { ++ for (size_t i = 0; i < nitems(auxv); i++) ++ if ((unsigned long)auxv[i].a_type == type) ++ return auxv[i].a_un.a_val; ++ ++ errno = ENOENT; ++ } ++ return 0; ++} ++#else ++#define AT_HWCAP 16 ++#define getauxval(x) 0 ++#endif /* */ + #include + #include +