git: 195e50541eca - main - libexec: Automatically generate rtld-elf list and generalise TAGS

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Thu, 27 Jul 2023 04:11:56 UTC
The branch main has been updated by jrtc27:

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

commit 195e50541eca73b8d40bed4223b87ba48cfed27d
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-07-27 04:10:45 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-07-27 04:10:45 +0000

    libexec: Automatically generate rtld-elf list and generalise TAGS
    
    Note that the pattern for matching is made slightly more specific, so as
    to permit libcompats where one is a prefix of another (e.g. CheriBSD has
    lib64 and lib64c).
    
    Reviewed by:    brooks, jhb, emaste, imp, kib
    Differential Revision:  https://reviews.freebsd.org/D41183
---
 libexec/Makefile          | 6 +++++-
 libexec/rtld-elf/Makefile | 8 ++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/libexec/Makefile b/libexec/Makefile
index a890115fd15a..f1e99e580e97 100644
--- a/libexec/Makefile
+++ b/libexec/Makefile
@@ -3,6 +3,8 @@
 
 .include <src.opts.mk>
 
+.include <bsd.compat.pre.mk>
+
 SUBDIR=	${_atf} \
 	${_atrun} \
 	${_blacklistd-helper} \
@@ -84,7 +86,9 @@ _tftp-proxy=	tftp-proxy
 
 .if !defined(NO_PIC) && !defined(NO_RTLD)
 _rtld-elf=	rtld-elf
-SUBDIR.${MK_LIB32}+=	rtld-elf32
+.for LIBCOMPAT libcompat in ${_ALL_LIBCOMPATS_libcompats}
+SUBDIR.${MK_LIB${LIBCOMPAT}}+=	rtld-elf${libcompat}
+.endfor
 .endif
 
 .if ${MK_RBOOTD} != "no"
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
index a132c756723f..5a31ca674a53 100644
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -14,13 +14,17 @@ MK_ASAN=	no
 MK_SSP=		no
 MK_UBSAN=	no
 
+.include <bsd.compat.pre.mk>
+
 .if !defined(NEED_COMPAT)
 CONFS=		libmap.conf
 .endif
 PROG?=		ld-elf.so.1
-.if (${PROG:M*ld-elf32*} != "")
-TAGS+=		lib32
+.for _libcompat in ${_ALL_libcompats}
+.if ${PROG:M*ld-elf${_libcompat}[-.]*} != ""
+TAGS+=		lib${_libcompat}
 .endif
+.endfor
 SRCS= \
 	crtbrand.S \
 	rtld_start.S \