git: 29d1d72ad529 - stable/13 - llvm: Reduce overlinking with the minimal llvm

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 07 Jan 2024 23:08:08 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=29d1d72ad5291b2c96f00ba744bdf3db5ec89153

commit 29d1d72ad5291b2c96f00ba744bdf3db5ec89153
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-11-09 13:00:51 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-01-07 23:04:33 +0000

    llvm: Reduce overlinking with the minimal llvm
    
    We only need to link against libz and libzstd when linking against the
    fill libllvm, libllvmminimal doesn't use either library. Move adding
    libz and libzstd to the list of libraries to link against to where
    we decide to use the full libllvm.
    
    Reported by:    Cristian Marussi <Cristian.Marussi@arm.com>
    Reported by:    Colin S. Gordon <csgordon@fastmail.com>
    Reviewed by:    dim
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D42528
    
    (cherry picked from commit 83771b1914e182c6324839e05ff82ee6f4a87c98)
---
 usr.bin/clang/clang.prog.mk | 4 ++--
 usr.bin/clang/llvm.prog.mk  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/usr.bin/clang/clang.prog.mk b/usr.bin/clang/clang.prog.mk
index c15b846c5aa8..cf48f02359e9 100644
--- a/usr.bin/clang/clang.prog.mk
+++ b/usr.bin/clang/clang.prog.mk
@@ -14,6 +14,8 @@ LIBDEPS+=	llvmminimal
 .else
 LIBDEPS+=	clang
 LIBDEPS+=	llvm
+LIBADD+=	z
+LIBADD+=	zstd
 .endif
 
 .for lib in ${LIBDEPS}
@@ -28,7 +30,5 @@ LIBADD+=	execinfo
 LIBADD+=	ncursesw
 .endif
 LIBADD+=	pthread
-LIBADD+=	z
-LIBADD+=	zstd
 
 .include <bsd.prog.mk>
diff --git a/usr.bin/clang/llvm.prog.mk b/usr.bin/clang/llvm.prog.mk
index a66d27f7f1e2..acd50582f768 100644
--- a/usr.bin/clang/llvm.prog.mk
+++ b/usr.bin/clang/llvm.prog.mk
@@ -12,6 +12,8 @@ CFLAGS+=	-I${OBJTOP}/lib/clang/libllvm
 LIBDEPS+=	llvmminimal
 .else
 LIBDEPS+=	llvm
+LIBADD+=	z
+LIBADD+=	zstd
 .endif
 
 .for lib in ${LIBDEPS}
@@ -26,7 +28,5 @@ LIBADD+=	execinfo
 LIBADD+=	ncursesw
 .endif
 LIBADD+=	pthread
-LIBADD+=	z
-LIBADD+=	zstd
 
 .include <bsd.prog.mk>