diff options
author | Chris Johns <chrisj@rtems.org> | 2018-04-12 14:09:48 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2018-04-12 17:54:59 +1000 |
commit | 2a61542f44fecb3bbc4b851673fd71b10c3af687 (patch) | |
tree | d8f8e7f5ff8b3854f8de4933b537377cd48e0734 | |
parent | 4ff09d5b3f0c8c3f0b5cbb98eb5a6731cb7015d6 (diff) |
libdl: RAP format fixes.
- Do not error if a RAP section is not found.
- Free a symbol table via the RTL allocator interface.
- Add the symbols to the global symbol table.
Update #2769
-rw-r--r-- | cpukit/libdl/rtl-rap.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/cpukit/libdl/rtl-rap.c b/cpukit/libdl/rtl-rap.c index 2fe9c6b13f..59b3801f76 100644 --- a/cpukit/libdl/rtl-rap.c +++ b/cpukit/libdl/rtl-rap.c @@ -246,11 +246,7 @@ rtems_rtl_rap_relocate (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj) targetsect = rtems_rtl_obj_find_section (obj, rap_sections[section].name); if (!targetsect) - { - rtems_rtl_set_error (EINVAL, "no target section found"); - free (symname_buffer); - return false; - } + continue; if (!rtems_rtl_rap_read_uint32 (rap->decomp, &header)) { @@ -592,7 +588,10 @@ rtems_rtl_rap_load_symbols (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj) (rap->symbols * sizeof (rtems_rtl_obj_sym_t))); if (!rtems_rtl_obj_comp_read (rap->decomp, rap->strtab, rap->strtab_size)) + { + rtems_rtl_alloc_del (RTEMS_RTL_ALLOC_SYMBOL, obj->global_table); return false; + } for (sym = 0, gsym = obj->global_table; sym < rap->symbols; ++sym) { @@ -605,7 +604,7 @@ rtems_rtl_rap_load_symbols (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj) !rtems_rtl_rap_read_uint32 (rap->decomp, &name) || !rtems_rtl_rap_read_uint32 (rap->decomp, &value)) { - free (obj->global_table); + rtems_rtl_alloc_del (RTEMS_RTL_ALLOC_SYMBOL, obj->global_table); obj->global_table = NULL; obj->global_syms = 0; obj->global_size = 0; @@ -629,7 +628,7 @@ rtems_rtl_rap_load_symbols (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj) { rtems_rtl_set_error (EINVAL, "duplicate global symbol: %s", rap->strtab + name); - free (obj->global_table); + rtems_rtl_alloc_del (RTEMS_RTL_ALLOC_SYMBOL, obj->global_table); obj->global_table = NULL; obj->global_syms = 0; obj->global_size = 0; @@ -639,7 +638,7 @@ rtems_rtl_rap_load_symbols (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj) symsect = rtems_rtl_obj_find_section_by_index (obj, data >> 16); if (!symsect) { - free (obj->global_table); + rtems_rtl_alloc_del (RTEMS_RTL_ALLOC_SYMBOL, obj->global_table); obj->global_table = NULL; obj->global_syms = 0; obj->global_size = 0; @@ -662,6 +661,9 @@ rtems_rtl_rap_load_symbols (rtems_rtl_rap_t* rap, rtems_rtl_obj_t* obj) ++gsym; } + if (obj->global_syms) + rtems_rtl_symbol_obj_add (obj); + return true; } |