diff --git a/util/crc32c.cc b/util/crc32c.cc index 80094239ce..9645d45064 100644 --- a/util/crc32c.cc +++ b/util/crc32c.cc @@ -37,6 +37,10 @@ #define AT_HWCAP2 26 #endif +#elif __FreeBSD__ +#include +#include +#include #endif /* __linux__ */ #endif @@ -467,6 +471,18 @@ static int arch_ppc_probe(void) { return arch_ppc_crc32; } +#elif __FreeBSD__ +static int arch_ppc_probe(void) { + unsigned long cpufeatures; + arch_ppc_crc32 = 0; + +#if defined(__powerpc64__) + elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures)); + if (cpufeatures & PPC_FEATURE2_HAS_VEC_CRYPTO) arch_ppc_crc32 = 1; +#endif /* __powerpc64__ */ + + return arch_ppc_crc32; +} #endif // __linux__ static bool isAltiVec() {