Skip to content

Commit 459f02e

Browse files
KimYannnclaude
andcommitted
build: enable isa-l NEON assembly on ARM macOS
macOS reports arm64 via uname -m but isa-l's Makefile.unx expects aarch64 for the NEON/SVE assembly paths. Without this fix, only the C baseline code is compiled, resulting in ~60% slower gzip decompression. Pass host_cpu=aarch64 arch=aarch64 on ARM macOS to build the full optimized library (85 objects vs 23 C-only). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c9ac5be commit 459f02e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,26 @@ GTEST_MAIN_LIB := $(DIR_GTEST)/build/lib/libgtest_main.a
3838

3939
# On Linux: fully static binary; on macOS: static libs, dynamic system runtime
4040
UNAME_S := $(shell uname -s)
41+
UNAME_M := $(shell uname -m)
4142
ifeq ($(UNAME_S),Linux)
4243
LD_FLAGS := -static -Wl,--no-as-needed -lpthread
4344
else
4445
LD_FLAGS := -lpthread
4546
endif
4647

48+
# isa-l: macOS reports arm64 but isa-l expects aarch64 for NEON assembly
49+
ISAL_MAKE_ARGS :=
50+
ifeq ($(UNAME_M),arm64)
51+
ISAL_MAKE_ARGS := host_cpu=aarch64 arch=aarch64
52+
endif
53+
4754
# Default target: build deps from submodules and link statically
4855
${BIN_TARGET}: $(ISAL_LIB) $(LIBDEFLATE_LIB) ${OBJ}
4956
$(CXX) $(OBJ) -o $@ $(ISAL_LIB) $(LIBDEFLATE_LIB) $(LD_FLAGS)
5057

5158
# Build isa-l static library from submodule
5259
$(ISAL_LIB):
53-
$(MAKE) -C $(DIR_ISAL) -f Makefile.unx lib
60+
$(MAKE) -C $(DIR_ISAL) -f Makefile.unx lib $(ISAL_MAKE_ARGS)
5461

5562
# Build libdeflate static library from submodule
5663
$(LIBDEFLATE_LIB):

0 commit comments

Comments
 (0)