[PATCH] libdl/debugger: Fix the broken list delete when unloading an object module.
chrisj at rtems.org
chrisj at rtems.org
Tue Aug 6 02:55:17 UTC 2019
From: Chris Johns <chrisj at rtems.org>
Closes #3777
---
.../start/{linkcmds => linkcmds.in} | 0
cpukit/libdl/rtl-debugger.c | 26 +++++++++----------
cpukit/libdl/rtl-elf.c | 2 --
3 files changed, 13 insertions(+), 15 deletions(-)
rename bsps/arm/raspberrypi/start/{linkcmds => linkcmds.in} (100%)
diff --git a/bsps/arm/raspberrypi/start/linkcmds b/bsps/arm/raspberrypi/start/linkcmds.in
similarity index 100%
rename from bsps/arm/raspberrypi/start/linkcmds
rename to 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)
{
--
2.19.1
More information about the devel
mailing list