Allow to load not-openable dso when tracing. This fixes ldd on such dso or

dso linked to non-openable object.
Remove '\n' at the end of error message.
End comments with dot.

MFC after:	3 weeks (together with r199829)
This commit is contained in:
kib 2009-11-28 14:29:32 +00:00
parent d5471c00ab
commit d9873126f6
2 changed files with 8 additions and 4 deletions

View File

@ -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);

View File

@ -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