aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index a301479..a58e8f8 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -43,8 +43,10 @@ internal_function
_dl_close (void *_map)
{
struct link_map **list;
+ struct link_map **rellist;
struct link_map *map = _map;
- unsigned nsearchlist;
+ unsigned int nsearchlist;
+ unsigned int nrellist;
unsigned int i;
if (map->l_opencount == 0)
@@ -65,6 +67,9 @@ _dl_close (void *_map)
list = map->l_searchlist.r_list;
nsearchlist = map->l_searchlist.r_nlist;
+ rellist = map->l_reldeps;
+ nrellist = map->l_reldepsact;
+
/* Call all termination functions at once. */
for (i = 0; i < nsearchlist; ++i)
{
@@ -192,6 +197,16 @@ _dl_close (void *_map)
}
}
+ /* Now we can perhaps also remove the modules for which we had
+ dependencies because of symbol lookup. */
+ if (rellist != NULL)
+ {
+ while (nrellist-- > 0)
+ _dl_close (rellist[nrellist]);
+
+ free (rellist);
+ }
+
free (list);
if (_dl_global_scope_alloc != 0