Add Aarch64 specific defines to Android cross-compile
Move <arm_acle.h> logic into "sonfig.h". Detecting when we can/should include <arm_acle.h> is proving to be troublesomepull/507/head
parent
40859a80da
commit
8d98417306
|
|
@ -11,7 +11,9 @@ MKDIR ?= mkdir
|
|||
EGREP ?= egrep
|
||||
LN ?= ln -sf
|
||||
|
||||
CLANG_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")
|
||||
$(info "EGREP: $(EGREP)")
|
||||
IS_ARMV8 := $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -i -c 'aarch32|aarch64')
|
||||
CLANG_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")
|
||||
|
||||
IS_IOS ?= 0
|
||||
IS_ANDROID ?= 0
|
||||
|
|
@ -176,6 +178,26 @@ ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
|
|||
endif # MAKECMDGOALS
|
||||
endif # Dead code stripping
|
||||
|
||||
# ARMv8-a
|
||||
ifeq ($(IS_ARMV8),1)
|
||||
HAVE_NEON := $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv8-a -dM -E - 2>/dev/null | $(EGREP) -i -c __ARM_NEON)
|
||||
ifeq ($(HAVE_NEON),1)
|
||||
ARIA_FLAG = -march=armv8-a
|
||||
BLAKE2_FLAG = -march=armv8-a
|
||||
NEON_FLAG = -march=armv8-a
|
||||
endif
|
||||
HAVE_CRC := $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv8-a+crc -dM -E - 2>/dev/null | $(EGREP) -i -c __ARM_FEATURE_CRC32)
|
||||
ifeq ($(HAVE_CRC),1)
|
||||
CRC_FLAG = -march=armv8-a+crc
|
||||
endif
|
||||
HAVE_CRYPTO := $(shell echo | $(CXX) -x c++ $(CXXFLAGS) -march=armv8-a+crypto -dM -E - 2>/dev/null | $(EGREP) -i -c __ARM_FEATURE_CRYPTO)
|
||||
ifeq ($(HAVE_CRYPTO),1)
|
||||
AES_FLAG = -march=armv8-a+crypto
|
||||
GCM_FLAG = -march=armv8-a+crypto
|
||||
SHA_FLAG = -march=armv8-a+crypto
|
||||
endif
|
||||
endif
|
||||
|
||||
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
||||
SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(sort $(wildcard *.cpp)))
|
||||
|
||||
|
|
@ -329,10 +351,46 @@ ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
|
|||
endif # Dependencies
|
||||
|
||||
cpu-features.o: cpu-features.h cpu-features.c
|
||||
$(CXX) $(strip $(CXXFLAGS) -fpermissive) -c cpu-features.c
|
||||
$(CXX) $(strip $(CXXFLAGS) -fpermissive -c) cpu-features.c
|
||||
|
||||
# SSE4.2 or NEON available
|
||||
aria-simd.o : aria-simd.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(ARIA_FLAG) -c) $<
|
||||
|
||||
# SSE4.2 or ARMv8a available
|
||||
blake2-simd.o : blake2-simd.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(BLAKE2_FLAG) -c) $<
|
||||
|
||||
# SSE2 on i586
|
||||
cpu.o : cpu.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(CPU_FLAG) -c) $<
|
||||
|
||||
# SSE4.2 or ARMv8a available
|
||||
crc-simd.o : crc-simd.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(CRC_FLAG) -c) $<
|
||||
|
||||
# PCLMUL or ARMv7a/ARMv8a available
|
||||
gcm-simd.o : gcm-simd.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(GCM_FLAG) -c) $<
|
||||
|
||||
# NEON available
|
||||
neon-simd.o : neon-simd.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(NEON_FLAG) -c) $<
|
||||
|
||||
# AESNI or ARMv7a/ARMv8a available
|
||||
rijndael-simd.o : rijndael-simd.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(AES_FLAG) -c) $<
|
||||
|
||||
# SSE4.2/SHA-NI or ARMv8a available
|
||||
sha-simd.o : sha-simd.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $<
|
||||
|
||||
# SSE4.2/SHA-NI or ARMv8a available
|
||||
shacal2-simd.o : shacal2-simd.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $<
|
||||
|
||||
%.o : %.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS)) -c $<
|
||||
$(CXX) $(strip $(CXXFLAGS) -c) $<
|
||||
|
||||
GNUmakefile.deps:
|
||||
$(CXX) $(strip $(CXXFLAGS)) -MM *.cpp > GNUmakefile.deps
|
||||
$(CXX) $(strip $(CXXFLAGS) -MM) *.cpp > GNUmakefile.deps
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@
|
|||
#include "misc.h"
|
||||
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||
# include "arm_neon.h"
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_SSSE3_AVAILABLE)
|
||||
# include "tmmintrin.h"
|
||||
# include <tmmintrin.h>
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@
|
|||
#include "blake2.h"
|
||||
|
||||
#if (CRYPTOPP_SSE42_AVAILABLE)
|
||||
# include "emmintrin.h"
|
||||
# include "nmmintrin.h"
|
||||
# include <emmintrin.h>
|
||||
# include <nmmintrin.h>
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||
# include "arm_neon.h"
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY
|
||||
|
|
|
|||
14
config.h
14
config.h
|
|
@ -548,13 +548,23 @@ NAMESPACE_END
|
|||
# endif
|
||||
#endif
|
||||
|
||||
// Don't include <arm_acle.h> when using Apple Clang. Early Apple compilers
|
||||
// fail to compile with <arm_acle.h> included. Later Apple compilers compile
|
||||
// intrinsics without <arm_acle.h> included. Also avoid it with GCC 4.8,
|
||||
// and avoid it on Android, too.
|
||||
#if defined(__ARM_ACLE) && !defined(CRYPTOPP_APPLE_CLANG_VERSION) && \
|
||||
(!defined(CRYPTOPP_GCC_VERSION) || (CRYPTOPP_GCC_VERSION >= 40900)) && \
|
||||
!defined(__ANDROID__)
|
||||
# define CRYPTOPP_ARM_ACLE_AVAILABLE 1
|
||||
#endif
|
||||
|
||||
// Requires ARMv8 and ACLE 2.0. GCC requires 4.8 and above.
|
||||
// LLVM Clang requires 3.5. Apple Clang is unknown at the moment.
|
||||
// Microsoft plans to support ARM-64, but its not clear how to detect it.
|
||||
// TODO: Add MSC_VER and ARM-64 platform define when available
|
||||
#if !defined(CRYPTOPP_ARM_CRC32_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM) && !defined(__apple_build_version__)
|
||||
# if defined(__ARM_FEATURE_CRC32) || (CRYPTOPP_MSC_VERSION >= 1910) || \
|
||||
defined(__aarch32__) || defined(__aarch64__)
|
||||
# if (defined(__ARM_FEATURE_CRC32) || (CRYPTOPP_MSC_VERSION >= 1910) || \
|
||||
defined(__aarch32__) || defined(__aarch64__)) && !defined(__ANDROID__)
|
||||
# define CRYPTOPP_ARM_CRC32_AVAILABLE 1
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,11 +24,7 @@
|
|||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Don't include <arm_acle.h> when using Apple Clang. Early Apple compilers
|
||||
// fail to compile with <arm_acle.h> included. Later Apple compilers compile
|
||||
// intrinsics without <arm_acle.h> included. Also avoid it with GCC 4.8.
|
||||
#if (CRYPTOPP_ARM_CRC32_AVAILABLE) && !defined(CRYPTOPP_APPLE_CLANG_VERSION) && \
|
||||
(!defined(CRYPTOPP_GCC_VERSION) || (CRYPTOPP_GCC_VERSION >= 40900))
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,7 @@
|
|||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Don't include <arm_acle.h> when using Apple Clang. Early Apple compilers
|
||||
// fail to compile with <arm_acle.h> included. Later Apple compilers compile
|
||||
// intrinsics without <arm_acle.h> included. Also avoid it with GCC 4.8.
|
||||
#if (CRYPTOPP_ARM_PMULL_AVAILABLE) && !defined(CRYPTOPP_APPLE_CLANG_VERSION) && \
|
||||
(!defined(CRYPTOPP_GCC_VERSION) || (CRYPTOPP_GCC_VERSION >= 40900))
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY
|
||||
# include <signal.h>
|
||||
# include <setjmp.h>
|
||||
|
|
|
|||
|
|
@ -43,11 +43,7 @@
|
|||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Don't include <arm_acle.h> when using Apple Clang. Early Apple compilers
|
||||
// fail to compile with <arm_acle.h> included. Later Apple compilers compile
|
||||
// intrinsics without <arm_acle.h> included. Also avoid it with GCC 4.8.
|
||||
#if (CRYPTOPP_ARM_AES_AVAILABLE) && !defined(CRYPTOPP_APPLE_CLANG_VERSION) && \
|
||||
(!defined(CRYPTOPP_GCC_VERSION) || (CRYPTOPP_GCC_VERSION >= 40900))
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -26,11 +26,7 @@
|
|||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Don't include <arm_acle.h> when using Apple Clang. Early Apple compilers
|
||||
// fail to compile with <arm_acle.h> included. Later Apple compilers compile
|
||||
// intrinsics without <arm_acle.h> included. Also avoid it with GCC 4.8.
|
||||
#if (CRYPTOPP_ARM_SHA_AVAILABLE) && !defined(CRYPTOPP_APPLE_CLANG_VERSION) && \
|
||||
(!defined(CRYPTOPP_GCC_VERSION) || (CRYPTOPP_GCC_VERSION >= 40900))
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -31,11 +31,7 @@
|
|||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Don't include <arm_acle.h> when using Apple Clang. Early Apple compilers
|
||||
// fail to compile with <arm_acle.h> included. Later Apple compilers compile
|
||||
// intrinsics without <arm_acle.h> included. Also avoid it with GCC 4.8.
|
||||
#if (CRYPTOPP_ARM_SHA_AVAILABLE) && !defined(CRYPTOPP_APPLE_CLANG_VERSION) && \
|
||||
(!defined(CRYPTOPP_GCC_VERSION) || (CRYPTOPP_GCC_VERSION >= 40900))
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue