summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2019-08-05 09:58:07 +1000
committerChris Johns <chrisj@rtems.org>2019-08-12 08:49:33 +1000
commit9cb19ded5c233b86c70157fe00b809792bc13d5a (patch)
tree03c49fd9cdc1d3fdab30f225ee7e258641150224
parent886956afd2dc10e2d8b6ec3aa9dc72976b6f58c9 (diff)
downloadrtems-9cb19ded5c233b86c70157fe00b809792bc13d5a.tar.bz2
libdl/debugger: Fix the broken list delete when unloading an object module.
Closes #3777
-rw-r--r--bsps/arm/raspberrypi/start/linkcmds.in (renamed from bsps/arm/raspberrypi/start/linkcmds)0
-rw-r--r--cpukit/libdl/rtl-debugger.c26
-rw-r--r--cpukit/libdl/rtl-elf.c2
3 files changed, 13 insertions, 15 deletions
diff --git a/bsps/arm/raspberrypi/start/linkcmds b/bsps/arm/raspberrypi/start/linkcmds.in
index 7a1bcbac73..7a1bcbac73 100644
--- a/bsps/arm/raspberrypi/start/linkcmds
+++ b/bsps/arm/raspberrypi/start/linkcmds.in
diff --git a/cpukit/libdl/rtl-debugger.c b/cpukit/libdl/rtl-debugger.c
index 92ab98e3c5..e6c5e161fd 100644
--- a/cpukit/libdl/rtl-debugger.c
+++ b/cpukit/libdl/rtl-debugger.c
@@ -64,13 +64,13 @@ _rtld_linkmap_add (rtems_rtl_obj* obj)
if (_rtld_debug.r_map == NULL)
{
_rtld_debug.r_map = l;
- return true;
}
-
- for (prev = _rtld_debug.r_map; prev->l_next != NULL; prev = prev->l_next);
-
- l->l_prev = prev;
- prev->l_next = l;
+ else
+ {
+ for (prev = _rtld_debug.r_map; prev->l_next != NULL; prev = prev->l_next);
+ l->l_prev = prev;
+ prev->l_next = l;
+ }
return true;
}
@@ -79,20 +79,20 @@ void
_rtld_linkmap_delete (rtems_rtl_obj* obj)
{
struct link_map* l = obj->linkmap;
+
/*
* link_maps are allocated together if not 1
*/
struct link_map* e = l + obj->obj_num - 1;
- while (e && e->l_next) e = e->l_next;
-
if (l->l_prev == NULL)
{
if ((_rtld_debug.r_map = e->l_next) != NULL)
- e->l_next->l_prev = NULL;
- return;
+ _rtld_debug.r_map->l_prev = NULL;
+ }
+ else
+ {
+ if ((l->l_prev->l_next = e->l_next) != NULL)
+ e->l_next->l_prev = l->l_prev;
}
-
- if ((l->l_prev->l_next = e->l_next) != NULL)
- e->l_next->l_prev = l->l_prev;
}
diff --git a/cpukit/libdl/rtl-elf.c b/cpukit/libdl/rtl-elf.c
index 0389408dd0..76001d9bfc 100644
--- a/cpukit/libdl/rtl-elf.c
+++ b/cpukit/libdl/rtl-elf.c
@@ -1593,8 +1593,6 @@ rtems_rtl_elf_load_linkmap (rtems_rtl_obj* obj)
obj->linkmap->sec_addr[rap_bss] = obj->bss_base;
sd = obj->linkmap->sec_detail;
- sections = &obj->sections;
- node = rtems_chain_first (sections);
for (m = 0; m < sect_masks; ++m)
{