Merge pull request #4376 from brad0/bsd_elf_aux_info
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run

Extend elf_aux_info() support for RISC-V on FreeBSD and OpenBSD

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2025-01-16 12:56:58 +01:00 committed by GitHub
commit a5fa1bdf76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -221,9 +221,9 @@ fi
# additional checks for RVV targets # additional checks for RVV targets
if test x$check_for_rvv = x1; then if test x$check_for_rvv = x1; then
AC_MSG_NOTICE([checking how to detect RVV availability]) AC_MSG_NOTICE([checking how to detect RVV availability])
AC_CHECK_FUNCS([getauxval]) AC_CHECK_FUNCS([getauxval elf_aux_info])
if test $ac_cv_func_getauxval = no; then if test $ac_cv_func_getauxval = no && test $ac_cv_func_elf_aux_info = no; then
AC_MSG_WARN([RVV is available, but we don't know how to check for it. Will not be able to use RVV.]) AC_MSG_WARN([RVV is available, but we don't know how to check for it. Will not be able to use RVV.])
fi fi
fi fi

View File

@ -66,7 +66,7 @@
#endif #endif
#if defined(HAVE_RVV) #if defined(HAVE_RVV)
# if defined(HAVE_GETAUXVAL) # if defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO)
# include <sys/auxv.h> # include <sys/auxv.h>
# define HWCAP_RV(letter) (1ul << ((letter) - 'A')) # define HWCAP_RV(letter) (1ul << ((letter) - 'A'))
# endif # endif
@ -244,6 +244,10 @@ SIMDDetect::SIMDDetect() {
# if defined(HAVE_GETAUXVAL) # if defined(HAVE_GETAUXVAL)
const unsigned long hwcap = getauxval(AT_HWCAP); const unsigned long hwcap = getauxval(AT_HWCAP);
rvv_available_ = hwcap & HWCAP_RV('V'); rvv_available_ = hwcap & HWCAP_RV('V');
# elif defined(HAVE_ELF_AUX_INFO)
unsigned long hwcap = 0;
elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
rvv_available_ = hwcap & HWCAP_RV('V');
# endif # endif
#endif #endif