config.mak.uname: avoid macOS dup-library warning

Building on macOS with Xcode 15 or newer emits: ld: warning: ignoring duplicate libraries: 'libgit.a', 'target/release/libgitcore.a' Some link recipes list the same archive twice, which is harmless. Quiet the warning instead. Pass -Wl,-no_warn_duplicate_libraries on Xcode 15 and newer, whose linkers added both the warning and the suppression flag (ld64-907 and dyld-1009). Earlier linkers reject the flag, so gate on the linker version. Broaden the existing -fno-common version probe to also match the "ld64-NNN" and "dyld-NNN" forms Xcode 15 reports. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Harald Nordgren committed Jun 19, 2026 at 20:32 UTC f6791de689be2f5b88b39def9ad5b73e38c32f7c
1 file changed +9 -2
config.mak.uname
+9 -2
@@ -160,8 +160,15 @@ ifeq ($(uname_S),Darwin)
160 NEEDS_GOOD_LIBICONV = UnfortunatelyYes
161 endif
162
163 - # Silence Xcode 16.3+ linker warning about __DATA,__common alignment.
164 - LD_MAJOR_VERSION = $(shell ld -v 2>&1 | sed -n 's/.*PROJECT:ld-\([0-9]*\).*/\1/p')
163 + # ld reports "PROJECT:{ld,ld64,dyld}-NNN", match any of the three.
164 + LD_MAJOR_VERSION = $(shell ld -v 2>&1 | sed -n 's/.*PROJECT:[^ ]*-\([0-9][0-9]*\).*/\1/p')
165 +
166 + # Silence the Xcode 15+ warning about archives listed more than once.
167 + ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 907 && echo 1),1)
168 + BASIC_LDFLAGS += -Wl,-no_warn_duplicate_libraries
169 + endif
170 +
171 + # Silence the Xcode 16.3+ warning about __DATA,__common alignment.
172 ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 1167 && echo 1),1)
173 BASIC_CFLAGS += -fno-common
174 endif