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

Alexander Kabaev kan at FreeBSD.org
Tue Jun 16 16:38:55 UTC 2009


Author: kan
Date: Tue Jun 16 16:38:54 2009
New Revision: 194298
URL: http://svn.freebsd.org/changeset/base/194298

Log:
  FreeBSD returns main object handle from dlopen(NULL, ...) calls.
  dlsym seaches using this handle are expected to look for symbol
  definitions in all objects loaded at the program start time along
  with all objects currently in RTLD_GLOBAL scope.
  
  Discussed with: kib
  Reported by:	Maho NAKATA
  MFC after:	2 weeks

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

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Tue Jun 16 15:30:10 2009	(r194297)
+++ head/libexec/rtld-elf/rtld.c	Tue Jun 16 16:38:54 2009	(r194298)
@@ -2130,6 +2130,16 @@ do_dlsym(void *handle, const char *name,
 	    /* Search main program and all libraries loaded by it. */
 	    def = symlook_list(name, hash, &list_main, &defobj, ve, flags,
 			       &donelist);
+
+	    /*
+	     * We do not distinguish between 'main' object an global scope.
+	     * If symbol is not defined by objects loaded at startup, continue
+	     * search among dynamically loaded objects with RTLD_GLOBAL
+	     * scope.
+	     */
+	    if (def == NULL)
+		def = symlook_list(name, hash, &list_global, &defobj, ve,
+		    		    flags, &donelist);
 	} else {
 	    Needed_Entry fake;
 


More information about the svn-src-head mailing list