]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config.mak.uname: avoid macOS linker warning on Xcode 16.3+
authorHarald Nordgren <haraldnordgren@gmail.com>
Tue, 2 Jun 2026 07:37:58 +0000 (07:37 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Jun 2026 08:30:01 +0000 (17:30 +0900)
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>
config.mak.uname

index 3c35ae33a3c0c074139783ef00d640b157ec23db..32b58e7a95091ebd624f3d533e2e97c3d1a7773e 100644 (file)
@@ -160,6 +160,12 @@ ifeq ($(uname_S),Darwin)
                NEEDS_GOOD_LIBICONV = UnfortunatelyYes
         endif
 
+       # Silence Xcode 16.3+ linker warning about __DATA,__common alignment.
+       LD_MAJOR_VERSION = $(shell ld -v 2>&1 | sed -n 's/.*PROJECT:ld-\([0-9]*\).*/\1/p')
+        ifeq ($(shell test -n "$(LD_MAJOR_VERSION)" && test "$(LD_MAJOR_VERSION)" -ge 1167 && echo 1),1)
+               BASIC_CFLAGS += -fno-common
+        endif
+
        # The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require
        # Unix domain sockets and PThreads.
         ifndef NO_PTHREADS