mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 10:05:05 -07:00
Detect ARM features with elf_aux_info on FreeBSD >= 12.0
by @devnexen, thanks! Fixes #1012
This commit is contained in:
parent
761c1b34cd
commit
45bca21a95
@ -864,7 +864,7 @@ if (&getentropy != NULL) {
|
||||
])
|
||||
AC_CHECK_FUNCS([posix_memalign getpid nanosleep])
|
||||
AC_CHECK_FUNCS([memset_s explicit_bzero explicit_memset])
|
||||
AC_CHECK_FUNCS([getauxval])
|
||||
AC_CHECK_FUNCS([getauxva elf_aux_info])
|
||||
|
||||
AC_SUBST([LIBTOOL_EXTRA_FLAGS])
|
||||
|
||||
|
@ -72,10 +72,24 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
|
||||
#elif defined(__aarch64__) && defined(AT_HWCAP)
|
||||
# ifdef HAVE_GETAUXVAL
|
||||
cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 1)) != 0;
|
||||
# elif defined(HAVE_ELF_AUX_INFO)
|
||||
{
|
||||
unsigned long buf;
|
||||
if (elf_aux_info(AT_HWCAP, (void *) &buf, (int) sizeof buf) == 0) {
|
||||
cpu_features->has_neon = (buf & (1L << 1)) != 0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#elif defined(__arm__) && defined(AT_HWCAP)
|
||||
# ifdef HAVE_GETAUXVAL
|
||||
cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 12)) != 0;
|
||||
# elif defined(HAVE_ELF_AUX_INFO)
|
||||
{
|
||||
unsigned long buf;
|
||||
if (elf_aux_info(AT_HWCAP, (void *) &buf, (int) sizeof buf) == 0) {
|
||||
cpu_features->has_neon = (buf & (1L << 12)) != 0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -107,10 +121,24 @@ _sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
|
||||
#elif defined(__aarch64__) && defined(AT_HWCAP)
|
||||
# ifdef HAVE_GETAUXVAL
|
||||
cpu_features->has_armcrypto = (getauxval(AT_HWCAP) & (1L << 3)) != 0;
|
||||
# elif defined(HAVE_ELF_AUX_INFO)
|
||||
{
|
||||
unsigned long buf;
|
||||
if (elf_aux_info(AT_HWCAP, (void *) &buf, (int) sizeof buf) == 0) {
|
||||
cpu_features->has_armcrypto = (buf & (1L << 3)) != 0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#elif defined(__arm__) && defined(AT_HWCAP2)
|
||||
# ifdef HAVE_GETAUXVAL
|
||||
cpu_features->has_armcrypto = (getauxval(AT_HWCAP2) & (1L << 0)) != 0;
|
||||
# elif defined(HAVE_ELF_AUX_INFO)
|
||||
{
|
||||
unsigned long buf;
|
||||
if (elf_aux_info(AT_HWCAP2, (void *) &buf, (int) sizeof buf) == 0) {
|
||||
cpu_features->has_armcrypto = (buf & (1L << 0)) != 0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user