]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix build on FreeBSD/powerpc*
authorPiotr Kubaj <pkubaj@anongoth.pl>
Tue, 6 Sep 2022 17:19:15 +0000 (19:19 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 13 Jan 2023 19:23:15 +0000 (20:23 +0100)
Use elf_aux_info() instead of getauxval() on FreeBSD.

arch/power/power_features.c

index 7c0350c66e65f6dbed217b9863cf56d349632ffc..62fc9495c6146e9660e7adaced3be7fdf2950e8b 100644 (file)
@@ -7,6 +7,9 @@
 #ifdef HAVE_SYS_AUXV_H
 #  include <sys/auxv.h>
 #endif
+#ifdef __FreeBSD__
+#include <machine/cpu.h>
+#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;