Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Sep 2022 00:29:44 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6958ee33b742 - stable/13 - ldd: remove '[preloaded]' marker for the preloaded objects
Message-ID:  <202209290029.28T0TiFU084629@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

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

commit 6958ee33b7426976bcafa3e743ae6f18e87cc3e4
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-09-18 00:49:30 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-09-29 00:29:09 +0000

    ldd: remove '[preloaded]' marker for the preloaded objects
    
    PR:     265750
    
    (cherry picked from commit 2f72ee987d492b3dc9116c5cf49777edd2474b11)
---
 libexec/rtld-elf/rtld.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 0cfd97d96389..99a79682971f 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -5002,7 +5002,12 @@ trace_print_obj(Obj_Entry *obj, const char *name, const char *path,
 	const char *fmt;
 	int c;
 
-	fmt = strncmp(name, "lib", 3) == 0 ? fmt1 : fmt2;	/* XXX bogus */
+	if (fmt1 == NULL)
+		fmt = fmt2;
+	else
+		/* XXX bogus */
+		fmt = strncmp(name, "lib", 3) == 0 ? fmt1 : fmt2;
+
 	while ((c = *fmt++) != '\0') {
 		switch (c) {
 		default:
@@ -5084,19 +5089,23 @@ trace_loaded_objects(Obj_Entry *obj, bool show_preload)
 	}
 
 	if (show_preload) {
+		if (ld_get_env_var(LD_TRACE_LOADED_OBJECTS_FMT2) == NULL)
+			fmt2 = "\t%p (%x)\n";
 		first_spurious = true;
+
 		TAILQ_FOREACH(obj, &obj_list, next) {
 			if (obj->marker || obj == obj_main || obj->traced)
 				continue;
 
-			if (first_spurious) {
+			if (list_containers && first_spurious) {
 				rtld_printf("[preloaded]\n");
 				first_spurious = false;
 			}
+
 			Name_Entry *fname = STAILQ_FIRST(&obj->names);
 			name = fname == NULL ? "<unknown>" : fname->name;
 			trace_print_obj(obj, name, obj->path, main_local,
-			    fmt1, fmt2);
+			    NULL, fmt2);
 		}
 	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202209290029.28T0TiFU084629>