git: c14351db0d06 - stable/12 - Suppress lld 16 errors about multiply defined symbols in rescue

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 29 Apr 2023 07:37:32 UTC
The branch stable/12 has been updated by dim:

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

commit c14351db0d06b67a2cc2b5318f25df07602bbe71
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-04-17 16:25:30 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-04-29 07:24:24 +0000

    Suppress lld 16 errors about multiply defined symbols in rescue
    
    lld >= 16 became more strict about multiply defined symbols. Since there
    are many of those in crunchgen'd programs, turn off the check when
    linking the rescue binary.
    
    MFC after:      1 week
    
    (cherry picked from commit 458f4722bf974c7fa7961952fcaee146f5a97708)
---
 rescue/rescue/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile
index 8faf4d29877b..4395aca895d1 100644
--- a/rescue/rescue/Makefile
+++ b/rescue/rescue/Makefile
@@ -8,6 +8,12 @@ MAN=
 MK_SSP=	no
 NO_SHARED=	yes
 
+# lld >= 16 became more strict about multiply defined symbols. Since there are
+# many of those in crunchgen'd programs, turn off the check.
+.if ${LINKER_TYPE} == "lld" && ${LINKER_VERSION} >= 160000
+LDFLAGS+=	-Wl,--allow-multiple-definition
+.endif
+
 PROG=	rescue
 BINDIR?=/rescue