diff options
author | pkubaj <pkubaj@users.noreply.github.com> | 2020-12-06 19:48:11 +0000 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2020-12-07 10:03:56 +1100 |
commit | 27edeca385a514f8e33f9d10e9e8790231b897c9 (patch) | |
tree | 75eae5957a15b18c1c836ecda35c47bd10452ae5 | |
parent | 83591a23d6c2a09d9c24cccbc7d6e20a6feffe86 (diff) | |
download | mariadb-git-pull/1710.tar.gz |
Implement CPU feature checks for FreeBSD/powerpc64pull/1710
Fixes build on powerpc64 and powerpc64le. OpenBSD probably needs similar change.
-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..79d1d195261 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__ +#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() { |