Adding ARM AT_HWCAP support for FreeBSD (#7750)

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/7750

Reviewed By: ltamasi

Differential Revision: D25400609

Pulled By: pdillinger

fbshipit-source-id: 13b15e2f490acc011b648fbd9615ea8e580cccc7
This commit is contained in:
Vincent Milum Jr 2020-12-08 13:32:04 -08:00 committed by Facebook GitHub Bot
parent 07030c6f4a
commit 93c6c18cf9

View File

@ -43,21 +43,23 @@
extern bool pmull_runtime_flag; extern bool pmull_runtime_flag;
uint32_t crc32c_runtime_check(void) { uint32_t crc32c_runtime_check(void) {
#ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT uint64_t auxv = 0;
uint64_t auxv = getauxval(AT_HWCAP); #if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT)
return (auxv & HWCAP_CRC32) != 0; auxv = getauxval(AT_HWCAP);
#else #elif defined(__FreeBSD__)
return 0; elf_aux_info(AT_HWCAP, &auxv, sizeof(auxv));
#endif #endif
return (auxv & HWCAP_CRC32) != 0;
} }
bool crc32c_pmull_runtime_check(void) { bool crc32c_pmull_runtime_check(void) {
#ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT uint64_t auxv = 0;
uint64_t auxv = getauxval(AT_HWCAP); #if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT)
return (auxv & HWCAP_PMULL) != 0; auxv = getauxval(AT_HWCAP);
#else #elif defined(__FreeBSD__)
return false; elf_aux_info(AT_HWCAP, &auxv, sizeof(auxv));
#endif #endif
return (auxv & HWCAP_PMULL) != 0;
} }
#ifdef ROCKSDB_UBSAN_RUN #ifdef ROCKSDB_UBSAN_RUN