diff options
author | pkubaj <pkubaj@users.noreply.github.com> | 2020-12-06 19:48:11 +0000 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2021-01-15 15:40:10 +1100 |
commit | dc3681e5ed15515c107f990f83c56735938fc071 (patch) | |
tree | 840592325b465eb4908371b74635ba9c00fdef9e | |
parent | deadec4e689c9435e20ebb89fd8f84d3f0f90ff3 (diff) | |
download | mariadb-git-bb-10.5-danielblack-pr1710-freebsd-powerpc64.tar.gz |
Implement CPU feature checks for FreeBSD/powerpc64bb-10.5-danielblack-pr1710-freebsd-powerpc64
Fixes build on powerpc64 and powerpc64le.
Closes: #1710
-rw-r--r-- | mysys/crc32/crc32c.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mysys/crc32/crc32c.cc b/mysys/crc32/crc32c.cc index c0f8c518691..f11a80fb5d8 100644 --- a/mysys/crc32/crc32c.cc +++ b/mysys/crc32/crc32c.cc @@ -476,6 +476,21 @@ static int arch_ppc_probe(void) { return arch_ppc_crc32; } +#elif __FreeBSD_version >= 1200000 +#include <machine/cpu.h> +#include <sys/auxv.h> +#include <sys/elf_common.h> +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() { |