mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
Update.
2000-10-24 Ulrich Drepper <drepper@redhat.com> Complete revamp of the reference counter handling. * include/link.h (struct link_map): Add l_idx field. * elf/dl-close.c: Handle decrementing of reference counters more correctly. If necessary decrement reference counters of dependencies of dependencies. * elf/dl-lookup.c (add_dependency): Only increment reference counter of the object itself and not also its dependencies. * elf/dl-open.c: Increment reference counters here. * elf/dl-deps.c: Remove reference counter handling here. * elf/dl-load.c: Likewise. * elf/rtld.c: Adjust for _dl_map_deps not handling reference counters. * elf/loadtest.c: Print loaded objects at the beginning.
This commit is contained in:
@ -785,10 +785,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -821,7 +817,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
|
||||
l = _dl_new_object (realname, name, l_type, loader);
|
||||
if (__builtin_expect (! l, 0))
|
||||
LOSE (ENOMEM, N_("cannot create shared object descriptor"));
|
||||
l->l_opencount = 1;
|
||||
|
||||
/* Extract the remaining details we need from the ELF header
|
||||
and then read in the program header table. */
|
||||
@ -1467,7 +1462,9 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
|
||||
/* 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. */
|
||||
if (l->l_opencount <= 0)
|
||||
/* XXX Is this test still correct after the reference counter
|
||||
handling rewrite? */
|
||||
if (l->l_opencount == 0)
|
||||
continue;
|
||||
if (!_dl_name_match_p (name, l))
|
||||
{
|
||||
@ -1487,11 +1484,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
|
||||
l->l_soname_added = 1;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
/* We have a match. */
|
||||
return l;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user