Disable GCC pragmas for Android NDK builds on x86
Fixes clang error due to invalid AVX2 pragma on x86 when building with Android NDK.
This commit is contained in:
1 parent
f5925c766e
commit
18cdd5e9c9
2 files changed
+11
-3
No files matched your search
@@ -500,6 +500,14 @@ set (TARGET_SOURCES
|
||||
${CMAKE_BINARY_DIR}/version_pm3.c
|
||||
)
|
||||
|
||||
# Enable AVX2 support for x86/x64
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|i.86")
|
||||
set_source_files_properties(
|
||||
src/loclass/cipher_bs_avx2.c
|
||||
PROPERTIES COMPILE_OPTIONS "-mavx2"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/version_pm3.c
|
||||
COMMAND sh ${PM3_ROOT}/tools/mkversion.sh ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__ANDROID__)
|
||||
#pragma GCC push_options
|
||||
#pragma GCC target("avx2")
|
||||
#endif
|
||||
@@ -263,14 +263,14 @@ void doMAC_brute_match256(const uint64_t y_bits_bs[96 * BS256_WORDS],
|
||||
_mm256_storeu_si256((__m256i *)match_out, mac_match);
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__ANDROID__)
|
||||
#pragma GCC pop_options
|
||||
#endif
|
||||
|
||||
bool bs_avx2_supported(void) {
|
||||
static int cached = -1;
|
||||
if (cached < 0) {
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__ANDROID__)
|
||||
__builtin_cpu_init();
|
||||
cached = __builtin_cpu_supports("avx2") ? 1 : 0;
|
||||
#else
|
||||
|
||||
Reference in new issue
Block a user