summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2014-11-04 16:34:37 +1100
committerChris Johns <chrisj@rtems.org>2014-11-04 16:34:37 +1100
commit028ed6c39036dfc787614dbb9a989fd7b47aea3f (patch)
treef365caaeb2275b717967f01487b2b4ae300c70be
parentlibtests: Add libdl test dl02. (diff)
downloadrtems-028ed6c39036dfc787614dbb9a989fd7b47aea3f.tar.bz2
libdl: RTLD_DEFAULT searches the global symbol table.
-rw-r--r--cpukit/libdl/dlfcn.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/cpukit/libdl/dlfcn.c b/cpukit/libdl/dlfcn.c
index 7c102022b2..278127417c 100644
--- a/cpukit/libdl/dlfcn.c
+++ b/cpukit/libdl/dlfcn.c
@@ -97,19 +97,28 @@ void*
dlsym (void* handle, const char *symbol)
{
rtems_rtl_obj_t* obj;
- rtems_rtl_obj_sym_t* sym;
+ rtems_rtl_obj_sym_t* sym = NULL;
void* symval = NULL;
if (!rtems_rtl_lock ())
return NULL;
- obj = dl_get_obj_from_handle (handle);
- if (obj)
+ /*
+ * If the handle is "default" search the global symbol table.
+ */
+ if (handle == RTLD_DEFAULT)
{
- sym = rtems_rtl_symbol_obj_find (obj, symbol);
- if (sym)
- symval = sym->value;
+ sym = rtems_rtl_symbol_global_find (symbol);
}
+ else
+ {
+ obj = dl_get_obj_from_handle (handle);
+ if (obj)
+ sym = rtems_rtl_symbol_obj_find (obj, symbol);
+ }
+
+ if (sym)
+ symval = sym->value;
rtems_rtl_unlock ();