diff options
author | Chris Johns <chrisj@rtems.org> | 2014-11-04 12:12:25 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-11-04 12:12:25 +1100 |
commit | a2e1e30d9862b0f926f694d146ab0e7450aa759b (patch) | |
tree | c064ceac36598376aa81b20feb12823841d74275 /cpukit/libdl/rtl-sym.c | |
parent | BSP for several Beagle products (diff) | |
download | rtems-a2e1e30d9862b0f926f694d146ab0e7450aa759b.tar.bz2 |
libdl: Add a local symbol table to the object module.
Adding a local symbol lets the relocator find local symbols referenced
in relocation records. The local symbol table is erased once the object
module has been loaded.
Diffstat (limited to 'cpukit/libdl/rtl-sym.c')
-rw-r--r-- | cpukit/libdl/rtl-sym.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/cpukit/libdl/rtl-sym.c b/cpukit/libdl/rtl-sym.c index f8063948bd..ebd68412c0 100644 --- a/cpukit/libdl/rtl-sym.c +++ b/cpukit/libdl/rtl-sym.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 2012 Chris Johns <chrisj@rtems.org> + * COPYRIGHT (c) 2012-2014 Chris Johns <chrisj@rtems.org> * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -208,9 +208,18 @@ rtems_rtl_symbol_obj_find (rtems_rtl_obj_t* obj, const char* name) * Check the object file's symbols first. If not found search the * global symbol table. */ - for (s = 0, sym = obj->global_table; s < obj->global_syms; ++s, ++sym) - if (strcmp (name, sym->name) == 0) - return sym; + if (obj->local_syms) + { + for (s = 0, sym = obj->local_table; s < obj->local_syms; ++s, ++sym) + if (strcmp (name, sym->name) == 0) + return sym; + } + if (obj->global_syms) + { + for (s = 0, sym = obj->global_table; s < obj->global_syms; ++s, ++sym) + if (strcmp (name, sym->name) == 0) + return sym; + } return rtems_rtl_symbol_global_find (name); } @@ -228,8 +237,21 @@ rtems_rtl_symbol_obj_add (rtems_rtl_obj_t* obj) } void +rtems_rtl_symbol_obj_erase_local (rtems_rtl_obj_t* obj) +{ + if (obj->local_table) + { + rtems_rtl_alloc_del (RTEMS_RTL_ALLOC_SYMBOL, obj->local_table); + obj->local_table = NULL; + obj->local_size = 0; + obj->local_syms = 0; + } +} + +void rtems_rtl_symbol_obj_erase (rtems_rtl_obj_t* obj) { + rtems_rtl_symbol_obj_erase_local (obj); if (obj->global_table) { rtems_rtl_obj_sym_t* sym; |