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
This commit is contained in:
Alexander Kabaev 2009-06-16 16:38:54 +00:00
parent 5d54b264b7
commit 1310f23766
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194298

View File

@ -2130,6 +2130,16 @@ do_dlsym(void *handle, const char *name, void *retaddr, const Ver_Entry *ve,
/* 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;