summaryrefslogtreecommitdiff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-09-07 07:57:11 +0000
committerUlrich Drepper <drepper@redhat.com>2001-09-07 07:57:11 +0000
commit5a21d307c518c911f81848b6c0056fcc39e3ddcd (patch)
tree9b2c8e176909392cb03b76cf2eb5d29e61c55d40 /elf/dl-close.c
parentb98e518f5627b95c79bf75d178ae41527c333886 (diff)
Update.
2001-09-07 Ulrich Drepper <drepper@redhat.com> * include/link.h (struct link_map): Add l_scope_mem and l_scope_max elements. Change l_scope to be a pointer only. * elf/dl-object.c (_dl_new_ojbect): Initialize l_scope and l_scope_max. * elf/dl-open.c (dl_open_worker): If dependency wasn't just opened here add searchlist of newly open file to the dependency's scope. * elf/dl-close.c (_dl_close): If dependency is used otherwise remove only searchlist from its scope. Free own scope array if necessary. * elf/Makefile (tests): Add dblload and dblunload now.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index e83865f0a1..dfc204d478 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -146,6 +146,25 @@ _dl_close (void *_map)
(imap, (void *) imap->l_addr
+ imap->l_info[DT_FINI]->d_un.d_ptr)) ();
}
+ else if (new_opencount[i] != 0 && imap->l_type == lt_loaded)
+ {
+ /* The object is still used. But the object we are unloading
+ right now is responsible for loading it and therefore we
+ have the search list of the current object in its scope.
+ Remove it. */
+ struct r_scope_elem **runp = imap->l_scope;
+
+ while (*runp != NULL)
+ if (*runp == &map->l_searchlist)
+ {
+ /* Copy all later elements. */
+ while ((runp[0] = runp[1]) != NULL)
+ ++runp;
+ break;
+ }
+ else
+ ++runp;
+ }
/* Store the new l_opencount value. */
imap->l_opencount = new_opencount[i];
@@ -241,6 +260,10 @@ _dl_close (void *_map)
if (imap != map)
free (imap->l_initfini);
+ /* Remove the scope array if we allocated it. */
+ if (imap->l_scope != imap->l_scope_mem)
+ free (imap->l_scope);
+
if (imap->l_phdr_allocated)
free ((void *) imap->l_phdr);