From f620ffe8990dd94bc063778f59f101488153fb99 Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 3 Jun 2019 18:40:12 +0700 Subject: [PATCH] #1026 Probably fixed iOS build. --- cmake/flags.cmake | 7 +++++++ src/common/cpu/BasicCpuInfo_arm.cpp | 7 ++++++- src/crypto/common/VirtualMemory_unix.cpp | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index d50b5c84b..d00366282 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -81,3 +81,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) endif() endif() + +if (NOT WIN32) + check_symbol_exists("__builtin___clear_cache" "stdlib.h" HAVE_BUILTIN_CLEAR_CACHE) + if (HAVE_BUILTIN_CLEAR_CACHE) + add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE) + endif() +endif() diff --git a/src/common/cpu/BasicCpuInfo_arm.cpp b/src/common/cpu/BasicCpuInfo_arm.cpp index 339613466..dea8de734 100644 --- a/src/common/cpu/BasicCpuInfo_arm.cpp +++ b/src/common/cpu/BasicCpuInfo_arm.cpp @@ -25,7 +25,8 @@ #include #include -#if __ARM_FEATURE_CRYPTO + +#if __ARM_FEATURE_CRYPTO && !defined(__APPLE__) # include # include #endif @@ -47,7 +48,11 @@ xmrig::BasicCpuInfo::BasicCpuInfo() : # endif # if __ARM_FEATURE_CRYPTO +# if !defined(__APPLE__) m_aes = getauxval(AT_HWCAP) & HWCAP_AES; +# else + m_aes = true; +# endif # endif } diff --git a/src/crypto/common/VirtualMemory_unix.cpp b/src/crypto/common/VirtualMemory_unix.cpp index 9ae2bdf3c..0297520a1 100644 --- a/src/crypto/common/VirtualMemory_unix.cpp +++ b/src/crypto/common/VirtualMemory_unix.cpp @@ -66,7 +66,7 @@ void *xmrig::VirtualMemory::allocateLargePagesMemory(size_t size) void xmrig::VirtualMemory::flushInstructionCache(void *p, size_t size) { -# ifndef __FreeBSD__ +# ifdef HAVE_BUILTIN_CLEAR_CACHE __builtin___clear_cache(reinterpret_cast(p), reinterpret_cast(p) + size); # endif }