[PATCH] AArch64: Fix libmvec archive member collisions [BZ #34946]

Pierre Blanchard pierre.blanchard@arm.com
Wed Nov 11 11:29:11 GMT 2026


Give AdvSIMD and SVE objects distinct basenames, since ar drops
directory names. Otherwise, incremental builds can overwrite members,
losing symbols and duplicating definitions.

Prefix object names with the ISA and use the generated sve_CFLAGS hook
for SVE options. The build directory stamps are no longer needed.

Fixes bug 34946 introduced in 5a60281b88a7dfd4423648fc8e1e02609219a4b6

Assisted-by: LLM
---
OK for master? If so please commit for me as I don't have commit rights.
Likewise if OK for backport to release branches as far back as 2.44.
Thanks,
Pierre
 sysdeps/aarch64/fpu/Makefile | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/sysdeps/aarch64/fpu/Makefile b/sysdeps/aarch64/fpu/Makefile
index 67952cc5f2..28ef77be88 100644
--- a/sysdeps/aarch64/fpu/Makefile
+++ b/sysdeps/aarch64/fpu/Makefile
@@ -45,20 +45,15 @@ double-sve-funcs = $(libmvec-supported-funcs)
 mathvec-types = float double
 mathvec-subdirs = advsimd sve
 
-ifeq ($(subdir),mathvec)
-generated-dirs += $(mathvec-subdirs)
-generated += $(addsuffix /stamp,$(mathvec-subdirs))
-before-compile += $(addprefix $(objpfx),$(addsuffix /stamp,$(mathvec-subdirs)))
-
-$(addprefix $(objpfx),$(addsuffix /stamp,$(mathvec-subdirs))):
-	$(make-target-directory)
-	touch $@
-
-sysd-rules-patterns += $(foreach dir,$(mathvec-subdirs),$(dir)/%:$(dir)/%)
+# Archive members do not retain their directories, so use distinct basenames
+# for AdvSIMD and SVE objects.
+sysd-rules-patterns += $(foreach dir,$(mathvec-subdirs),\
+                        $(dir)_%:$(dir)/%)
 
+ifeq ($(subdir),mathvec)
 define libmvec-routines-for
-$(addprefix $(1)/,$(addsuffix f,$(float-$(1)-funcs))) \
-$(addprefix $(1)/,$(double-$(1)-funcs))
+$(addprefix $(1)_,$(addsuffix f,$(float-$(1)-funcs))) \
+$(addprefix $(1)_,$(double-$(1)-funcs))
 endef
 
 libmvec-vector-routines = $(foreach dir,$(mathvec-subdirs),\
@@ -128,11 +123,7 @@ $(foreach type,$(mathvec-types),\
     $(eval $(call sve-bench-cflags-template,$(type),$(f)))))
 
 # Specialize CFLAGS used for building SVE sources.
-define sve-object-cflags-template
-$(objpfx)sve/%$(1): CFLAGS += $(sve-cflags)
-endef
-
-$(foreach o,$(all-object-suffixes),$(eval $(call sve-object-cflags-template,$(o))))
+sve_CFLAGS = $(sve-cflags)
 
 CFLAGS-test-float-sve-wrappers.c = $(sve-cflags)
 CFLAGS-test-double-sve-wrappers.c = $(sve-cflags)
-- 
2.53.0



More information about the Libc-alpha mailing list