about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-24 07:36:55 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-24 07:36:55 +0000
commit42c4f32a44c76d1f4e2b744bf80f495dc36caa87 (patch)
tree475224614ae3e30c27dc1889e86468080c48cf9c /elf/dl-load.c
parent69c3325490f56db660b349d7c04daab6aaea1bf1 (diff)
downloadglibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.tar.gz
glibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.tar.xz
glibc-42c4f32a44c76d1f4e2b744bf80f495dc36caa87.zip
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.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index bb3a2e3187..80fbf65c6b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -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;
     }