aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-21 06:02:49 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-21 06:02:49 +0000
commit8699e7b1daa5d250b8bc69e1ecffae80170277e5 (patch)
tree6ee2841f9875e4bf2d1f73f1539b0ad3bd9b5406 /elf/dl-load.c
parentf6de2239e2cb1af87b36dbd8712bd27f42ae7d54 (diff)
downloadglibc-8699e7b1daa5d250b8bc69e1ecffae80170277e5.zip
glibc-8699e7b1daa5d250b8bc69e1ecffae80170277e5.tar.gz
glibc-8699e7b1daa5d250b8bc69e1ecffae80170277e5.tar.bz2
Update.
* elf/dl-close.c: Decrement opencount for all dependencies which can be removed even if the object is not yet unloaded. * elf/dl-deps.c (_dl_map_object_deps): If dependency is already in the list decrement opencount of all dependencies. * elf/dl-load.c (_dl_map_object_from_fd): Increment object of object and all dependencies. (_dl_map_object): Likewise. * elf/dl-lookup.c (add_dependency): Likewise. * elf/loadtest.c: Add debug when with more output.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index b2f5ad7..55725c3 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -777,6 +777,8 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
for (l = _dl_loaded; l; l = l->l_next)
if (l->l_ino == st.st_ino && l->l_dev == st.st_dev)
{
+ unsigned int i;
+
/* The object is already loaded.
Just bump its reference count and return it. */
__close (fd);
@@ -785,6 +787,10 @@ _dl_map_object_from_fd (const char *name, int fd, char *realname,
it. */
free (realname);
add_name_to_object (l, name);
+
+ if (l->l_initfini != NULL)
+ for (i = 1; l->l_initfini[i] != NULL; ++i)
+ ++l->l_initfini[i]->l_opencount;
++l->l_opencount;
return l;
}
@@ -1396,6 +1402,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
/* Look for this name among those already loaded. */
for (l = _dl_loaded; l; l = l->l_next)
{
+ unsigned int i;
+
/* If the requested name matches the soname of a loaded object,
use that object. Elide this check for names that have not
yet been opened. */
@@ -1408,8 +1416,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
if (l->l_info[DT_SONAME] == NULL)
continue;
- soname = (const void *) (D_PTR (l, l_info[DT_STRTAB])
- + l->l_info[DT_SONAME]->d_un.d_val);
+ soname = ((const char *) D_PTR (l, l_info[DT_STRTAB])
+ + l->l_info[DT_SONAME]->d_un.d_val);
if (strcmp (name, soname) != 0)
continue;
@@ -1418,6 +1426,9 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
}
/* We have a match -- bump the reference count and return it. */
+ if (l->l_initfini != NULL)
+ for (i = 1; l->l_initfini[i] != NULL; ++i)
+ ++l->l_initfini[i]->l_opencount;
++l->l_opencount;
return l;
}