Skip to content

Commit df2c69a

Browse files
committed
Fixes for elf_aux_info support
- Remove the unnecessary use of the sys/elf.h header - Add RISC-V support
1 parent dcb2ef9 commit df2c69a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ fi
221221
# additional checks for RVV targets
222222
if test x$check_for_rvv = x1; then
223223
AC_MSG_NOTICE([checking how to detect RVV availability])
224-
AC_CHECK_FUNCS([getauxval])
224+
AC_CHECK_FUNCS([getauxval elf_aux_info])
225225
226-
if test $ac_cv_func_getauxval = no; then
226+
if test $ac_cv_func_getauxval = no && test $ac_cv_func_elf_aux_info = no; then
227227
AC_MSG_WARN([RVV is available, but we don't know how to check for it. Will not be able to use RVV.])
228228
fi
229229
fi

src/arch/simddetect.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@
6161
# include <sys/auxv.h>
6262
# elif defined(HAVE_ELF_AUX_INFO)
6363
# include <sys/auxv.h>
64-
# include <sys/elf.h>
6564
# endif
6665
#endif
6766

6867
#if defined(HAVE_RVV)
69-
# if defined(HAVE_GETAUXVAL)
68+
# if defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO)
7069
# include <sys/auxv.h>
7170
# define HWCAP_RV(letter) (1ul << ((letter) - 'A'))
7271
# endif
@@ -244,6 +243,10 @@ SIMDDetect::SIMDDetect() {
244243
# if defined(HAVE_GETAUXVAL)
245244
const unsigned long hwcap = getauxval(AT_HWCAP);
246245
rvv_available_ = hwcap & HWCAP_RV('V');
246+
# elif defined(HAVE_ELF_AUX_INFO)
247+
unsigned long hwcap = 0;
248+
elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
249+
rvv_available_ = hwcap & HWCAP_RV('V');
247250
# endif
248251
#endif
249252

0 commit comments

Comments
 (0)