From 120d86d43acc7bc502fa983f7f8aba0aabd253f1 Mon Sep 17 00:00:00 2001 From: Tino Reichardt Date: Mon, 26 Sep 2022 19:32:22 +0200 Subject: [PATCH] Fix double declaration of getauxval() for FreeBSD PPC The extern declaration is only for Linux, move this line into the right #ifdef section. Reviewed-by: Richard Yao Reviewed-by: Ryan Moeller Co-authored-by: Martin Matuska Signed-off-by: Tino Reichardt Closes #13934 Closes #13936 --- include/os/freebsd/spl/sys/simd_powerpc.h | 4 +++- lib/libspl/include/sys/simd.h | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/os/freebsd/spl/sys/simd_powerpc.h b/include/os/freebsd/spl/sys/simd_powerpc.h index b90240580c7a..34d5e23e2fbb 100644 --- a/include/os/freebsd/spl/sys/simd_powerpc.h +++ b/include/os/freebsd/spl/sys/simd_powerpc.h @@ -53,7 +53,7 @@ #include #include -#include +#include #define kfpu_allowed() 1 #define kfpu_initialize(tsk) do {} while (0) @@ -88,3 +88,5 @@ zfs_isa207_available(void) { return ((cpu_features2 & PPC_FEATURE2_ARCH_2_07) != 0); } + +#endif diff --git a/lib/libspl/include/sys/simd.h b/lib/libspl/include/sys/simd.h index c0099dd7919b..2be5173f317c 100644 --- a/lib/libspl/include/sys/simd.h +++ b/lib/libspl/include/sys/simd.h @@ -453,12 +453,12 @@ zfs_avx512vbmi_available(void) #elif defined(__powerpc__) /* including clashes with AT_UID and others */ -extern unsigned long getauxval(unsigned long type); #if defined(__FreeBSD__) #define AT_HWCAP 25 /* CPU feature flags. */ #define AT_HWCAP2 26 /* CPU feature flags 2. */ extern int elf_aux_info(int aux, void *buf, int buflen); -static unsigned long getauxval(unsigned long key) +static inline unsigned long +getauxval(unsigned long key) { unsigned long val = 0UL; @@ -470,6 +470,7 @@ static unsigned long getauxval(unsigned long key) #elif defined(__linux__) #define AT_HWCAP 16 /* CPU feature flags. */ #define AT_HWCAP2 26 /* CPU feature flags 2. */ +extern unsigned long getauxval(unsigned long type); #endif #define kfpu_allowed() 1