Implement getauxval(3) using elf_aux_info(3) to unbreak
riscv64 cpu feature detection.

Index: numpy/_core/src/common/npy_cpu_features.c
--- numpy/_core/src/common/npy_cpu_features.c.orig
+++ numpy/_core/src/common/npy_cpu_features.c
@@ -825,6 +825,17 @@ npy__cpu_init_features(void)
 
 #include <sys/auxv.h>
 
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+static unsigned long getauxval(unsigned long k)
+{
+    unsigned long val = 0ul;
+    if (elf_aux_info((int)k, (void *)&val, (int)sizeof(val)) != 0) {
+    	return 0ul;
+    }
+    return val;
+}
+#endif
+
 #ifndef HWCAP_RVV
     // https://github.com/torvalds/linux/blob/v6.8/arch/riscv/include/uapi/asm/hwcap.h#L24
     #define COMPAT_HWCAP_ISA_V	(1 << ('V' - 'A'))
