git: 83771b1914e1 - main - llvm: Reduce overlinking with the minimal llvm

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Fri, 10 Nov 2023 10:06:53 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=83771b1914e182c6324839e05ff82ee6f4a87c98

commit 83771b1914e182c6324839e05ff82ee6f4a87c98
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-11-09 13:00:51 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-11-10 09:57:44 +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
---
 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 87f804063c86..0c102730999f 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+=	tinfow
 .endif
 LIBADD+=	pthread
-LIBADD+=	z
-LIBADD+=	zstd
 
 .include <bsd.prog.mk>