Brad Smith <[email protected]> writes:
> OpenBSD 7.6 will add elf_aux_info(). The sysctl path will be used for
> previous releases, so yes it is still necessary.
Thanks, makes sense. Merged to the master-updates branch for testing
(even though, unfortunately, I have no continuous testing
set up for any BSD flavor on any arch).
> BTW, this also adds support for FreeBSD/arm64.
I'm considering the below followup patch, to reduce level of #if
nesting. Does it look right?
(Also not sure why USE_GETAUXVAL is defined the way it is, duplicated in
several places, it should perhaps just be a configure test setting
HAVE_GETAUXVAL).
Regards,
/Niels
diff --git a/fat-ppc.c b/fat-ppc.c
index c4dae3a1..9d50e5b1 100644
--- a/fat-ppc.c
+++ b/fat-ppc.c
@@ -55,7 +55,7 @@
# endif
# ifdef HAVE_ELF_AUX_INFO
# include <sys/auxv.h>
-# elif !defined(__OpenBSD__)
+# elif defined(__FreeBSD__)
# include <sys/sysctl.h>
# endif
#endif
@@ -129,17 +129,15 @@ get_ppc_features (struct ppc_features *features)
# if USE_GETAUXVAL
hwcap = getauxval(AT_HWCAP);
hwcap2 = getauxval(AT_HWCAP2);
-# elif defined(__FreeBSD__) || defined(__OpenBSD__)
-# ifdef HAVE_ELF_AUX_INFO
+# elif defined(HAVE_ELF_AUX_INFO)
elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2));
-# elif !defined(__OpenBSD__)
+# elif defined(__FreeBSD__)
size_t len;
len = sizeof(hwcap);
sysctlbyname("hw.cpu_features", &hwcap, &len, NULL, 0);
len = sizeof(hwcap2);
sysctlbyname("hw.cpu_features2", &hwcap2, &len, NULL, 0);
-# endif
# endif
features->have_crypto_ext
= ((hwcap2 & PPC_FEATURE2_VEC_CRYPTO) == PPC_FEATURE2_VEC_CRYPTO);
--
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]