Skip to content

Commit

Permalink
Fixes for elf_aux_info support
Browse files Browse the repository at this point in the history
- Remove the unnecessary use of the sys/elf.h header

- Add RISC-V support
  • Loading branch information
brad0 committed Dec 26, 2024
1 parent dcb2ef9 commit df2c69a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ fi
# additional checks for RVV targets
if test x$check_for_rvv = x1; then
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.])
fi
fi
Expand Down
7 changes: 5 additions & 2 deletions src/arch/simddetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@
# include <sys/auxv.h>
# elif defined(HAVE_ELF_AUX_INFO)
# include <sys/auxv.h>
# include <sys/elf.h>
# endif
#endif

#if defined(HAVE_RVV)
# if defined(HAVE_GETAUXVAL)
# if defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO)
# include <sys/auxv.h>
# define HWCAP_RV(letter) (1ul << ((letter) - 'A'))
# endif
Expand Down Expand Up @@ -244,6 +243,10 @@ SIMDDetect::SIMDDetect() {
# if defined(HAVE_GETAUXVAL)
const unsigned long hwcap = getauxval(AT_HWCAP);
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

Expand Down

0 comments on commit df2c69a

Please sign in to comment.