From: Cameron Cawley Date: Thu, 29 Feb 2024 21:56:20 +0000 (+0000) Subject: Use -Wa,-march with older ARM toolchains X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=231c4b3a641bef64dc02ec5b8844519de06c15d2;p=thirdparty%2Fzlib-ng.git Use -Wa,-march with older ARM toolchains --- diff --git a/cmake/detect-intrinsics.cmake b/cmake/detect-intrinsics.cmake index 9ab351af..cf0ee526 100644 --- a/cmake/detect-intrinsics.cmake +++ b/cmake/detect-intrinsics.cmake @@ -11,6 +11,16 @@ macro(check_armv8_compiler_flag) check_c_compiler_flag("-march=armv8-a+crc+simd" HAVE_MARCH_ARMV8_CRC_SIMD) if(HAVE_MARCH_ARMV8_CRC_SIMD) set(ARMV8FLAG "-march=armv8-a+crc+simd" CACHE INTERNAL "Compiler option to enable ARMv8 support") + else() + check_c_compiler_flag("-Wa,-march=armv8-a+crc" HAVE_WA_MARCH_ARMV8_CRC) + if(HAVE_WA_MARCH_ARMV8_CRC) + set(ARMV8FLAG "-Wa,-march=armv8-a+crc" CACHE INTERNAL "Compiler option to enable ARMv8 support") + else() + check_c_compiler_flag("-Wa,-march=armv8-a+crc+simd" HAVE_WA_MARCH_ARMV8_CRC_SIMD) + if(HAVE_WA_MARCH_ARMV8_CRC_SIMD) + set(ARMV8FLAG "-Wa,-march=armv8-a+crc+simd" CACHE INTERNAL "Compiler option to enable ARMv8 support") + endif() + endif() endif() endif() endif() @@ -52,6 +62,11 @@ macro(check_armv6_compiler_flag) check_c_compiler_flag("-march=armv6" HAVE_MARCH_ARMV6) if(HAVE_MARCH_ARMV6) set(ARMV6FLAG "-march=armv6" CACHE INTERNAL "Compiler option to enable ARMv6 support") + else() + check_c_compiler_flag("-Wa,-march=armv6" HAVE_WA_MARCH_ARMV6) + if(HAVE_WA_MARCH_ARMV6) + set(ARMV6FLAG "-Wa,-march=armv6" CACHE INTERNAL "Compiler option to enable ARMv6 support") + endif() endif() endif() endif() diff --git a/configure b/configure index c5b570d0..c365d1bf 100755 --- a/configure +++ b/configure @@ -1136,6 +1136,18 @@ EOF armv8flag="-march=armv8-a+crc+simd" else echo "Check whether -march=armv8-a+crc+simd works ... No." | tee -a configure.log + if try $CC -c $CFLAGS -Wa,-march=armv8-a+crc $test.c; then + echo "Check whether -Wa,-march=armv8-a+crc works ... Yes." | tee -a configure.log + armv8flag="-Wa,-march=armv8-a+crc" + else + echo "Check whether -Wa,-march=armv8-a+crc works ... No." | tee -a configure.log + if try $CC -c $CFLAGS -Wa,-march=armv8-a+crc+simd $test.c; then + echo "Check whether -Wa,-march=armv8-a+crc+simd works ... Yes." | tee -a configure.log + armv8flag="-Wa,-march=armv8-a+crc+simd" + else + echo "Check whether -Wa,-march=armv8-a+crc+simd works ... No." | tee -a configure.log + fi + fi fi fi @@ -1230,6 +1242,12 @@ EOF echo "Check whether -march=armv6 works ... Yes." | tee -a configure.log else echo "Check whether -march=armv6 works ... No." | tee -a configure.log + if try $CC -c $CFLAGS -Wa,-march=armv6 $test.c; then + armv6flag=-Wa,-march=armv6 + echo "Check whether -Wa,-march=armv6 works ... Yes." | tee -a configure.log + else + echo "Check whether -Wa,-march=armv6 works ... No." | tee -a configure.log + fi fi # Check whether compiler supports ARMv6 inline asm