Commit d79141d6 authored by David Carlier's avatar David Carlier Committed by Daniel Black

msys: detects crc/cryptosupport on FreeBSD/arm

closes #1737

Reviewers: Marko Mäkelä, Krunal Bauskar
parent dc3681e5
......@@ -86,7 +86,14 @@ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
return ret;
}
#include <sys/auxv.h>
int main() { foo(0); getauxval(AT_HWCAP); }" HAVE_ARMV8_CRC)
int main() { foo(0);
#ifdef __linux__
getauxval(AT_HWCAP);
#else
unsigned long v;
elf_aux_info(AT_HWCAP, &v, sizeof(v));
#endif
}" HAVE_ARMV8_CRC)
CHECK_CXX_SOURCE_COMPILES("
asm(\".arch_extension crypto\");
......@@ -95,7 +102,14 @@ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
return ret;
}
#include <sys/auxv.h>
int main() { foo(0); getauxval(AT_HWCAP); }" HAVE_ARMV8_CRYPTO)
int main() { foo(0);
#ifdef __linux__
getauxval(AT_HWCAP);
#else
unsigned long v;
elf_aux_info(AT_HWCAP, &v, sizeof(v));
#endif
}" HAVE_ARMV8_CRYPTO)
CHECK_C_COMPILER_FLAG(-march=armv8-a+crc+crypto HAVE_ARMV8_CRC_CRYPTO_MARCH)
......
......@@ -2,10 +2,20 @@
#include <string.h>
#include <stdint.h>
#if defined(__GNUC__) && defined(HAVE_ARMV8_CRC)
#if defined(HAVE_ARMV8_CRC)
#include <sys/auxv.h>
#include <asm/hwcap.h>
#if defined(__FreeBSD__)
static unsigned long getauxval(unsigned int key)
{
unsigned long val;
if (elf_aux_info(key, (void *)&val, (int)sizeof(val) != 0)
return 0ul;
return val;
}
#else
# include <asm/hwcap.h>
#endif
#ifndef HWCAP_CRC32
# define HWCAP_CRC32 (1 << 7)
......@@ -40,7 +50,7 @@ const char *crc32c_aarch64_available(void)
return "Using ARMv8 crc32 instructions";
}
#endif /* __GNUC__ && HAVE_ARMV8_CRC */
#endif /* HAVE_ARMV8_CRC */
#ifndef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment