git: 2bf21b0e8e6f - main - Restore DT_DEBUG processing

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 06 Jan 2022 07:15:29 UTC
The branch main has been updated by kib:

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

commit 2bf21b0e8e6f472f116a5806c05c379f0aaf4c55
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-01-06 07:14:09 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-01-06 07:14:09 +0000

    Restore DT_DEBUG processing
    
    Pointed out by: kevans
    Fixes:  292cba9b4919ee188ca08cc8bf5057e346514383
    Sponsored by:   The FreeBSD Foundation
---
 libexec/rtld-elf/rtld.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 14c4d44f50e4..e5ab2405a79c 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1461,6 +1461,12 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
 	    obj->fini_array_num = dynp->d_un.d_val / sizeof(Elf_Addr);
 	    break;
 
+	case DT_DEBUG:
+	    if (!early)
+		dbg("Filling in DT_DEBUG entry");
+	    (__DECONST(Elf_Dyn *, dynp))->d_un.d_ptr = (Elf_Addr)&r_debug;
+	    break;
+
 	case DT_FLAGS:
 		if (dynp->d_un.d_val & DF_ORIGIN)
 		    obj->z_origin = true;