[openwrt/openwrt] zlib: only enable NEON optimizations on eligible targets

LEDE Commits lede-commits at lists.infradead.org
Sun Jan 7 03:34:11 PST 2018


jow pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/3f5e39e960921167421317e2cdf6a37ae1330352

commit 3f5e39e960921167421317e2cdf6a37ae1330352
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Thu Jan 4 14:43:34 2018 +0100

    zlib: only enable NEON optimizations on eligible targets
    
    Instead of inferring the availability of NEON support from the target
    optimization flags, use a preprocessor test to decide whether to enable
    ARMv8 NEON optimizations.
    
    Fixes the following build error spotted by the mediatek/32 buildbot:
    
        [ 26%] Building C object CMakeFiles/zlib.dir/contrib/arm/inflate.o
        In file included from .../zlib-1.2.11/contrib/arm/chunkcopy.h:10:0,
                         from .../zlib-1.2.11/contrib/arm/inflate.c:87:
        .../arm_neon.h:31:2: error: #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
         #error You must enable NEON instructions (e.g. -mfloat-abi=softfp -mfpu=neon) to use arm_neon.h
          ^
        In file included from .../zlib-1.2.11/contrib/arm/inflate.c:87:0:
        .../zlib-1.2.11/contrib/arm/chunkcopy.h:18:9: error: unknown type name 'uint8x16_t'
         typedef uint8x16_t chunkcopy_chunk_t;
                 ^
        [...]
        CMakeFiles/zlib.dir/build.make:302: recipe for target 'CMakeFiles/zlib.dir/contrib/arm/inflate.o' failed
    
    Fixes: 3acecba520 "package/libs/zlib: Add ARM and NEON optimizations"
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 package/libs/zlib/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/package/libs/zlib/Makefile b/package/libs/zlib/Makefile
index 94977b0..a7c61f7 100644
--- a/package/libs/zlib/Makefile
+++ b/package/libs/zlib/Makefile
@@ -60,10 +60,8 @@ ifeq ($(CONFIG_ZLIB_OPTIMIZE_SPEED),y)
 	TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) -O3
 endif
 
-ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),)
-	CMAKE_OPTIONS += \
-		-DARMv8=ON
-endif
+CMAKE_OPTIONS += \
+	-DARMv8=$$$$(echo -e '\#ifdef __ARM_NEON__\nON\n\#else\nOFF\n\#endif' | $$(TARGET_CC) $$(TARGET_CFLAGS) -x c -E - | grep -xE 'ON|OFF')
 
 define Build/InstallDev
 	mkdir -p $(1)/usr/include



More information about the lede-commits mailing list