mirror of https://github.com/facebook/rocksdb.git
Fix build on FreeBSD/powerpc64(le) (#7732)
Summary: To build on FreeBSD, arch_ppc_probe needs to be adapted to FreeBSD. Since FreeBSD uses elf_aux_info as an getauxval equivalent, use it and include necessary headers: - machine/cpu.h for PPC_FEATURE2_HAS_VEC_CRYPTO, - sys/auxv.h for elf_aux_info, - sys/elf_common.h for AT_HWCAP2. elf_aux_info isn't checked for being available, because it's available since FreeBSD 12.0. rocksdb assumes using Clang on FreeBSD, but powerpc* platforms switch to Clang only since 13.0. This patch makes rocksdb build on FreeBSD on powerpc64 and powerpc64le platforms. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7732 Reviewed By: ltamasi Differential Revision: D25399194 Pulled By: pdillinger fbshipit-source-id: 9c905147d75f98cd2557dd2f86a940b8e6c5afcd
This commit is contained in:
parent
93c6c18cf9
commit
66e54c5984
|
@ -37,6 +37,10 @@
|
|||
#define AT_HWCAP2 26
|
||||
#endif
|
||||
|
||||
#elif __FreeBSD__
|
||||
#include <machine/cpu.h>
|
||||
#include <sys/auxv.h>
|
||||
#include <sys/elf_common.h>
|
||||
#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() {
|
||||
|
|
Loading…
Reference in New Issue