From: Piotr Kubaj Date: Tue, 6 Sep 2022 17:19:15 +0000 (+0200) Subject: Fix build on FreeBSD/powerpc* X-Git-Tag: 2.1.0-beta1~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9121a3c425a7d71ce54439e83deec6b8da4738b3;p=thirdparty%2Fzlib-ng.git Fix build on FreeBSD/powerpc* Use elf_aux_info() instead of getauxval() on FreeBSD. --- diff --git a/arch/power/power_features.c b/arch/power/power_features.c index 7c0350c66..62fc9495c 100644 --- a/arch/power/power_features.c +++ b/arch/power/power_features.c @@ -7,6 +7,9 @@ #ifdef HAVE_SYS_AUXV_H # include #endif +#ifdef __FreeBSD__ +#include +#endif #include "../../zbuild.h" #include "power_features.h" @@ -17,7 +20,11 @@ Z_INTERNAL int power_cpu_has_arch_3_00 = 0; void Z_INTERNAL power_check_features(void) { #ifdef PPC_FEATURES unsigned long hwcap; +#ifdef __FreeBSD__ + elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)); +#else hwcap = getauxval(AT_HWCAP); +#endif if (hwcap & PPC_FEATURE_HAS_ALTIVEC) power_cpu_has_altivec = 1; @@ -25,7 +32,11 @@ void Z_INTERNAL power_check_features(void) { #ifdef POWER_FEATURES unsigned long hwcap2; +#ifdef __FreeBSD__ + elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2)); +#else hwcap2 = getauxval(AT_HWCAP2); +#endif if (hwcap2 & PPC_FEATURE2_ARCH_2_07) power_cpu_has_arch_2_07 = 1;