From 9ff08a36a4f4e6b2246561254ca7bf0dc0518c8e Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Tue, 10 Sep 2024 01:28:52 -0400 Subject: [PATCH] Add support for elf_aux_info() on OpenBSD --- configure.ac | 2 +- simd.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 87e928d47..f6bd7a428 100644 --- a/configure.ac +++ b/configure.ac @@ -326,7 +326,7 @@ HTS_HIDE_DYNAMIC_SYMBOLS dnl FIXME This pulls in dozens of standard header checks AC_FUNC_MMAP -AC_CHECK_FUNCS([gmtime_r fsync drand48 srand48_deterministic]) +AC_CHECK_FUNCS([gmtime_r fsync drand48 srand48_deterministic elf_aux_info]) # Darwin has a dubious fdatasync() symbol, but no declaration in AC_CHECK_DECL([fdatasync(int)], [AC_CHECK_FUNCS(fdatasync)]) diff --git a/simd.c b/simd.c index 865dd887e..5c9c407d2 100644 --- a/simd.c +++ b/simd.c @@ -42,7 +42,7 @@ DEALINGS IN THE SOFTWARE. */ #if defined __arm__ || defined __aarch64__ -#if defined __linux__ || defined __FreeBSD__ +#if defined __linux__ || defined HAVE_ELF_AUX_INFO #include #elif defined __APPLE__ #include @@ -73,11 +73,11 @@ static inline int cpu_supports_neon(void) { if (sysctlbyname("hw.optional.AdvSIMD", &ctl, &ctlsize, NULL, 0) != 0) return 0; if (ctlsize != sizeof ctl) return 0; return ctl; -#elif defined __FreeBSD__ && defined __arm__ && defined HWCAP_NEON +#elif defined HAVE_ELF_AUX_INFO && defined __arm__ && defined HWCAP_NEON unsigned long cap; if (elf_aux_info(AT_HWCAP, &cap, sizeof cap) != 0) return 0; return (cap & HWCAP_NEON) != 0; -#elif defined __FreeBSD__ && defined __aarch64__ && defined HWCAP_ASIMD +#elif defined HAVE_ELF_AUX_INFO && defined __aarch64__ && defined HWCAP_ASIMD unsigned long cap; if (elf_aux_info(AT_HWCAP, &cap, sizeof cap) != 0) return 0; return (cap & HWCAP_ASIMD) != 0;