aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2022-09-18 00:49:30 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2022-09-29 00:29:09 +0000
commit6958ee33b7426976bcafa3e743ae6f18e87cc3e4 (patch)
tree1bd7a49d92a8af0b4ef7787d0658a2a8d7a71230
parent6315a1aac7ac7120b9aba5a3239a00ed05be4d1f (diff)
downloadsrc-6958ee33b7426976bcafa3e743ae6f18e87cc3e4.tar.gz
src-6958ee33b7426976bcafa3e743ae6f18e87cc3e4.zip
ldd: remove '[preloaded]' marker for the preloaded objects
PR: 265750 (cherry picked from commit 2f72ee987d492b3dc9116c5cf49777edd2474b11)
-rw-r--r--libexec/rtld-elf/rtld.c15
1 files 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);
}
}
}