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;
uint32_t crc32c_runtime_check(void) {
#ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT
uint64_t auxv = getauxval(AT_HWCAP);
return (auxv & HWCAP_CRC32) != 0;
#else
return 0;
uint64_t auxv = 0;
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT)
auxv = getauxval(AT_HWCAP);
#elif defined(__FreeBSD__)
elf_aux_info(AT_HWCAP, &auxv, sizeof(auxv));
#endif
return (auxv & HWCAP_CRC32) != 0;
}
bool crc32c_pmull_runtime_check(void) {
#ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT
uint64_t auxv = getauxval(AT_HWCAP);
return (auxv & HWCAP_PMULL) != 0;
#else
return false;
uint64_t auxv = 0;
#if defined(ROCKSDB_AUXV_GETAUXVAL_PRESENT)
auxv = getauxval(AT_HWCAP);
#elif defined(__FreeBSD__)
elf_aux_info(AT_HWCAP, &auxv, sizeof(auxv));
#endif
return (auxv & HWCAP_PMULL) != 0;
}
#ifdef ROCKSDB_UBSAN_RUN