git: ff6b71c2b214 - main - rescue: Stop using LDADD_zstd

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Thu, 22 Feb 2024 20:56:21 UTC
The branch main has been updated by jrtc27:

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

commit ff6b71c2b214c8a22c53c79228ef51e445508cc2
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-02-22 20:56:05 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-02-22 20:56:05 +0000

    rescue: Stop using LDADD_zstd
    
    Ideally we'd be able to use LDADD_foo here for all our various libs and
    get the implicit dependencies, but rescue is a bit special. Historically
    this was just used to pick up the "private" in the name automatically
    (as far as I can tell), but now that _DP_pthread includes c we end up
    pulling in a -lc from this (along with -lcompiler_rt and -lsys). This
    results in -lc being before -lmd (and after, implictly, from the
    compiler driver), which, for the specific situation here, results in
    both libc.a's and libmd.a's md5c.o being included, giving duplicate
    definitions of _libmd_MD5Init and other symbols. With LLD 16+ we
    currently make that not an error for other reasons (which should
    probably be fixed), but not for older versions, nor for BFD, and so the
    build fails.
    
    Fix all this by just using -lprivatezstd in place of LDADD_zstd, which
    results in the exact same clang command line as we used to have prior to
    adding c (and sys) to _DP_pthread when linking rescue. Note that bsdbox
    already uses -lprivatezstd rather than LDADD_zstd.
    
    This reverts commit 5fead429ebb3800fdd3fc0817d2c330b2a8d640f.
    
    Reviewed by:    imp
    Fixes:          99ea67573164 ("lib{c,sys}: move auxargs more firmly into libsys")
---
 rescue/rescue/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile
index 5d5c609eb218..c1ba22885618 100644
--- a/rescue/rescue/Makefile
+++ b/rescue/rescue/Makefile
@@ -216,7 +216,7 @@ CRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat
 
 CRUNCH_PROGS_usr.bin+= zstd
 CRUNCH_ALIAS_zstd= unzstd zstdcat zstdmt
-CRUNCH_LIBS+=	${LDADD_zstd}
+CRUNCH_LIBS+=	-lprivatezstd
 
 CRUNCH_PROGS_usr.bin+=	fetch
 CRUNCH_LIBS+=	-lfetch