svn commit: r199877 - head/libexec/rtld-elf

Konstantin Belousov kib at FreeBSD.org
Sat Nov 28 14:29:32 UTC 2009


Author: kib
Date: Sat Nov 28 14:29:32 2009
New Revision: 199877
URL: http://svn.freebsd.org/changeset/base/199877

Log:
  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)

Modified:
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Sat Nov 28 13:20:29 2009	(r199876)
+++ head/libexec/rtld-elf/rtld.c	Sat Nov 28 14:29:32 2009	(r199877)
@@ -1571,9 +1571,10 @@ do_load_object(int fd, const char *name,
     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);
 

Modified: head/libexec/rtld-elf/rtld.h
==============================================================================
--- head/libexec/rtld-elf/rtld.h	Sat Nov 28 13:20:29 2009	(r199876)
+++ head/libexec/rtld-elf/rtld.h	Sat Nov 28 14:29:32 2009	(r199877)
@@ -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


More information about the svn-src-head mailing list