From ed1882ef51197d8d824ac50d946a7fff850066a1 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Mon, 23 Nov 2020 18:32:06 -0800 Subject: [PATCH] seems to fix compilation on M1 Apple Silicon --- util/crc32c.cc | 6 +++--- util/crc32c_arm64.cc | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/util/crc32c.cc b/util/crc32c.cc index a709e9b1ce8..65d65c84b3b 100644 --- a/util/crc32c.cc +++ b/util/crc32c.cc @@ -470,7 +470,7 @@ static bool isAltiVec() { } #endif -#if defined(__linux__) && defined(HAVE_ARM64_CRC) +#if defined(HAVE_ARM64_CRC) uint32_t ExtendARMImpl(uint32_t crc, const char *buf, size_t size) { return crc32c_arm64(crc, (const unsigned char *)buf, size); } @@ -490,7 +490,7 @@ std::string IsFastCrc32Supported() { has_fast_crc = false; arch = "PPC"; #endif -#elif defined(__linux__) && defined(HAVE_ARM64_CRC) +#elif defined(HAVE_ARM64_CRC) if (crc32c_runtime_check()) { has_fast_crc = true; arch = "Arm64"; @@ -1222,7 +1222,7 @@ uint32_t crc32c_3way(uint32_t crc, const char* buf, size_t len) { static inline Function Choose_Extend() { #ifdef HAVE_POWER8 return isAltiVec() ? ExtendPPCImpl : ExtendImpl; -#elif defined(__linux__) && defined(HAVE_ARM64_CRC) +#elif defined(HAVE_ARM64_CRC) if(crc32c_runtime_check()) { return ExtendARMImpl; } else { diff --git a/util/crc32c_arm64.cc b/util/crc32c_arm64.cc index 7df01e6bb2a..809a2a71f43 100644 --- a/util/crc32c_arm64.cc +++ b/util/crc32c_arm64.cc @@ -5,9 +5,11 @@ #include "util/crc32c_arm64.h" -#if defined(__linux__) && defined(HAVE_ARM64_CRC) +#if defined(HAVE_ARM64_CRC) +#if defined(__linux__) #include +#endif #ifdef ROCKSDB_AUXV_GETAUXVAL_PRESENT #include #endif