diff options
author | kan <kan@FreeBSD.org> | 2009-06-16 16:38:54 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2009-06-16 16:38:54 +0000 |
commit | 5b73b70b12b0011769b98004c706f20fdaa9918f (patch) | |
tree | e91941ea186edc47d2b7f7a7efbf15485d799383 /libexec | |
parent | 056d36800b31924fd585c5332cf2e76993692ae7 (diff) | |
download | FreeBSD-src-5b73b70b12b0011769b98004c706f20fdaa9918f.zip FreeBSD-src-5b73b70b12b0011769b98004c706f20fdaa9918f.tar.gz |
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
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/rtld.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 40ed6ed..7e4c995 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -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; |