svn commit: r195180 - stable/7/libexec/rtld-elf

Alexander Kabaev kan at FreeBSD.org
Tue Jun 30 03:05:51 UTC 2009


Author: kan
Date: Tue Jun 30 03:05:50 2009
New Revision: 195180
URL: http://svn.freebsd.org/changeset/base/195180

Log:
  MFC r194298:
  
  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.

Modified:
  stable/7/libexec/rtld-elf/   (props changed)
  stable/7/libexec/rtld-elf/rtld.c

Modified: stable/7/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/7/libexec/rtld-elf/rtld.c	Mon Jun 29 23:53:27 2009	(r195179)
+++ stable/7/libexec/rtld-elf/rtld.c	Tue Jun 30 03:05:50 2009	(r195180)
@@ -1966,6 +1966,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 and 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-stable-7 mailing list