From: Hans Kristian Rosbach Date: Fri, 20 Sep 2019 20:50:50 +0000 (+0200) Subject: Unify detection of ARM getauxval code availability. X-Git-Tag: 1.9.9-b1~416 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0480bc800f2f8c452b3a7c33434010d94b76446;p=thirdparty%2Fzlib-ng.git Unify detection of ARM getauxval code availability. We don't want to compile arch-specific code when WITH_OPTIM is not set, and the current checks don't take that into account. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index cfa0806d7..a9a6a5a6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -521,6 +521,7 @@ endif() if(WITH_OPTIM) if(BASEARCH_ARM_FOUND) + add_definitions(-DARM_GETAUXVAL) list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/armfeature.c ${ARCHDIR}/fill_window_arm.c) if(WITH_NEON) list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/adler32_neon.c) @@ -541,7 +542,7 @@ if(WITH_OPTIM) add_feature_info(ACLE_CRC 1 "Support CRC hash generation using the ACLE instruction set, using \"${ACLEFLAG}\"") endif() elseif(BASEARCH_X86_FOUND) - add_definitions("-DX86_CPUID") + add_definitions(-DX86_CPUID) list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/x86.c) if(HAVE_SSE42CRC_INLINE_ASM OR HAVE_SSE42CRC_INTRIN) add_definitions(-DX86_SSE42_CRC_HASH) diff --git a/deflate.c b/deflate.c index 8ee4f1be9..242c809ea 100644 --- a/deflate.c +++ b/deflate.c @@ -266,9 +266,9 @@ int ZEXPORT PREFIX(deflateInit2_)(PREFIX3(stream) *strm, int level, int method, int wrap = 1; static const char my_version[] = PREFIX2(VERSION); -#ifdef X86_CPUID +#if defined(X86_CPUID) x86_check_features(); -#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64) +#elif defined(ARM_GETAUXVAL) arm_check_features(); #endif diff --git a/functable.c b/functable.c index 8ae696052..fcdd34cd9 100644 --- a/functable.c +++ b/functable.c @@ -17,9 +17,9 @@ extern Pos insert_string_acle(deflate_state *const s, const Pos str, unsigned in #endif /* fill_window */ -#ifdef X86_SSE2 +#if defined(X86_SSE2) extern void fill_window_sse(deflate_state *s); -#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64) +#elif defined(ARM_GETAUXVAL) extern void fill_window_arm(deflate_state *s); #endif @@ -90,12 +90,12 @@ ZLIB_INTERNAL void fill_window_stub(deflate_state *s) { // Initialize default functable.fill_window=&fill_window_c; - #ifdef X86_SSE2 + #if defined(X86_SSE2) # if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) if (x86_cpu_has_sse2) # endif functable.fill_window=&fill_window_sse; - #elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64) + #elif defined(ARM_GETAUXVAL) functable.fill_window=&fill_window_arm; #endif diff --git a/inflate.c b/inflate.c index fae8847d3..0b17e318d 100644 --- a/inflate.c +++ b/inflate.c @@ -130,9 +130,9 @@ int ZEXPORT PREFIX(inflateInit2_)(PREFIX3(stream) *strm, int windowBits, const c int ret; struct inflate_state *state; -#ifdef X86_CPUID +#if defined(X86_CPUID) x86_check_features(); -#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64) +#elif defined(ARM_GETAUXVAL) arm_check_features(); #endif diff --git a/zutil.h b/zutil.h index 92f47063a..9db420088 100644 --- a/zutil.h +++ b/zutil.h @@ -240,7 +240,7 @@ void ZLIB_INTERNAL zng_cfree(void *opaque, void *ptr); #if defined(X86_CPUID) # include "arch/x86/x86.h" -#elif defined(__aarch64__) || defined(__arm__) || defined(_M_ARM) || defined(_M_ARM64) +#elif defined(ARM_GETAUXVAL) # include "arch/arm/arm.h" #endif