From: Harald Nordgren via GitGitGadget Date: Fri, 29 May 2026 14:32:43 GMT Subject: [PATCH v2] config.mak.uname: avoid macOS linker warning on Xcode 16.3+ Message-ID: In-Reply-To: From: Harald Nordgren 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 --- pkt-line: initialize packet_buffer to avoid macOS linker warning * Check MacOS ld version instead (https://en.wikipedia.org/wiki/Xcode#Xcode_15.0_-_16.x_(since_visionOS_support)_2) Parsing output of ❯ ld -v @(#)PROGRAM:ld PROJECT:ld-1267 BUILD 18:30:29 Apr 22 2026 configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em armv8m.main armv8.1m.main will use ld-classic for: armv6 armv7 armv7s i386 armv6m armv7k armv7m armv7em LTO support using: LLVM version 21.0.0 (static support for 30, runtime is 30) TAPI support using: Apple TAPI version 21.0.0 (tapi-2100.0.2.6) Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2313%2FHaraldNordgren%2Fpkt-line-init-buffer-v2 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2313/HaraldNordgren/pkt-line-init-buffer-v2 Pull-Request: https://github.com/git/git/pull/2313 Range-diff vs v1: 1: 1c1c66d85b < -: ---------- pkt-line: initialize packet_buffer to avoid macOS linker warning -: ---------- > 1: 0e660a346e config.mak.uname: avoid macOS linker warning on Xcode 16.3+ config.mak.uname | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config.mak.uname b/config.mak.uname index ce5e7de779..d4d55cb324 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -163,6 +163,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 "$(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 base-commit: c69baaf57ba26cf117c2b6793802877f19738b0d -- gitgitgadget