Skip to content

Commit 5cd4d0d

Browse files
HaraldNordgrengitster
authored andcommitted
config.mak.uname: avoid macOS linker warning on Xcode 16.3+
Building on macOS with Xcode 16.3 or newer emits: ld: warning: reducing alignment of section __DATA,__common from 0x8000 to 0x4000 because it exceeds segment maximum alignment Pass -fno-common when "ld -v" reports ld-1167 or newer, so tentative definitions of large arrays go into BSS instead of __DATA,__common. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 67ad421 commit 5cd4d0d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

config.mak.uname

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ ifeq ($(uname_S),Darwin)
160160
NEEDS_GOOD_LIBICONV = UnfortunatelyYes
161161
endif
162162

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')
165+
ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 1167 && echo 1),1)
166+
BASIC_CFLAGS += -fno-common
167+
endif
168+
163169
# The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require
164170
# Unix domain sockets and PThreads.
165171
ifndef NO_PTHREADS

0 commit comments

Comments
 (0)