diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 320aa854c8b3..bffae60d573c 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1571,9 +1571,10 @@ do_load_object(int fd, const char *name, char *path, struct stat *sbp, object_add_name(obj, name); obj->path = path; digest_dynamic(obj, 0); - if (obj->z_noopen && (flags & RTLD_LO_DLOPEN)) { + if (obj->z_noopen && (flags & (RTLD_LO_DLOPEN | RTLD_LO_TRACE)) == + RTLD_LO_DLOPEN) { dbg("refusing to load non-loadable \"%s\"", obj->path); - _rtld_error("Cannot dlopen non-loadable %s\n", obj->path); + _rtld_error("Cannot dlopen non-loadable %s", obj->path); munmap(obj->mapbase, obj->mapsize); obj_free(obj); return (NULL); @@ -2006,6 +2007,8 @@ dlopen(const char *name, int mode) lo_flags = RTLD_LO_DLOPEN; if (mode & RTLD_NOLOAD) lo_flags |= RTLD_LO_NOLOAD; + if (ld_tracing != NULL) + lo_flags |= RTLD_LO_TRACE; objlist_init(&initlist); diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 6f51d7db7820..875e84bc7e63 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -242,8 +242,9 @@ typedef struct Struct_Obj_Entry { dlsym. */ /* Flags for load_object(). */ -#define RTLD_LO_NOLOAD 0x01 /* dlopen() specified RTLD_NOLOAD */ -#define RTLD_LO_DLOPEN 0x02 /* load_object() called from dlopen(). */ +#define RTLD_LO_NOLOAD 0x01 /* dlopen() specified RTLD_NOLOAD. */ +#define RTLD_LO_DLOPEN 0x02 /* Load_object() called from dlopen(). */ +#define RTLD_LO_TRACE 0x04 /* Only tracing. */ /* * Symbol cache entry used during relocation to avoid multiple lookups