Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 2009 16:38:54 +0000 (UTC)
From:      Alexander Kabaev <kan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r194298 - head/libexec/rtld-elf
Message-ID:  <200906161638.n5GGcsRQ033650@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906161638.n5GGcsRQ033650>