git: 5a98473132e6 - stable/14 - rtld: unconditionally generate map file during build

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 07 Mar 2024 00:34:59 UTC
The branch stable/14 has been updated by kib:

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

commit 5a98473132e61babb8885dc3c3feda2766d02ddd
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-02-28 00:04:37 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-03-07 00:34:34 +0000

    rtld: unconditionally generate map file during build
    
    (cherry picked from commit 799940154c70597a46627deb4d0b98e174b27b98)
---
 libexec/rtld-elf/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
index fe7e39a6b788..cc40b839024f 100644
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -73,6 +73,12 @@ SYMBOL_MAPS+=	${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map
 .sinclude "${RTLD_ELF_DIR}/${RTLD_ARCH}/Makefile.inc"
 RTLD_ENTRY?=	.rtld_start
 
+# Always produce the map file so that may be inspected to confirm
+# undesired code is not linked from libsys/libc.
+MAPFILE=	ld-elf.so.1.map
+LDFLAGS+=	-Wl,-Map=${MAPFILE} -Wl,--cref
+CLEANFILES+=	${MAPFILE}
+
 # Since moving rtld-elf to /libexec, we need to create a symlink.
 # Fixup the existing binary that's there so we can symlink over it.
 beforeinstall: