about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-06 09:16:53 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-06 09:16:53 +0000
commitbe93561004695198611aa8707f10250f780988b2 (patch)
tree7b9a502d849b761d966114b855a1fa9de4022e90 /elf/dl-close.c
parent9eb71e60ef889158238c3066c75b65336d846684 (diff)
downloadglibc-be93561004695198611aa8707f10250f780988b2.tar.gz
glibc-be93561004695198611aa8707f10250f780988b2.tar.xz
glibc-be93561004695198611aa8707f10250f780988b2.zip
Update.
1998-09-06 09:00  Ulrich Drepper  <drepper@cygnus.com>

	* version.h (VERSION): Bump to 2.0.96.

	Rewrite runtime linker to be truly thread-safe.  There is now no
	global variable specifying the scope.  We create all needed
	scopes at the time the link maps are created.
	* elf/Versions [GLIBC_2.1]: Add _dl_loaded and _dl_main_searchlist.
	* elf/link.h: Add struct r_scope_elem and use this for l_searchlist,
	l_symbolic_searchlist, l_scope, and l_local_scope elements in
	struct link_map.
	* elf/dl-close.c: Rewritten accordingly.
	* elf/dl-deps.c: Likewise.
	* elf/dl-error.c: Likewise.
	* elf/dl-init.c: Likewise.
	* elf/dl-load.c: Likewise.
	* elf/dl-lookup.c: Likewise.
	* elf/dl-object.c: Likewise.
	* elf/dl-open.c: Likewise.
	* elf/dl-reloc.c: Likewise.
	* elf/dl-runtime.c: Likewise.
	* elf/dl-support.c: Likewise.
	* elf/dl-symbol.c: Likewise.
	* elf/dl-version.c: Likewise.
	* elf/dlfcn.h: Likewise.
	* elf/dlsym.c: Likewise.
	* elf/dlvsym.c: Likewise.
	* elf/ldsodefs.h: Likewise.
	* elf/rtld.c: Likewise.
	* iconv/gconv_dl.c: Likewise.
	* nss/nsswitch.c: Likewise.
	* sysdeps/i386/dl-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 3b1e3c9f57..a260539440 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -57,8 +57,8 @@ _dl_close (struct link_map *map)
       return;
     }
 
-  list = map->l_searchlist;
-  nsearchlist = map->l_nsearchlist;
+  list = map->l_searchlist.r_list;
+  nsearchlist = map->l_searchlist.r_nlist;
 
   /* Call all termination functions at once.  */
   for (i = 0; i < nsearchlist; ++i)
@@ -103,16 +103,18 @@ _dl_close (struct link_map *map)
 	  if (imap->l_global)
 	    {
 	      /* This object is in the global scope list.  Remove it.  */
-	      struct link_map **tail = _dl_global_scope_end;
+	      unsigned int cnt = _dl_main_searchlist->r_nlist;
+
 	      do
-		--tail;
-	      while (*tail != imap);
-	      while (tail < _dl_global_scope_end)
+		--cnt;
+	      while (_dl_main_searchlist->r_list[cnt] != imap);
+	      while (cnt < _dl_main_searchlist->r_nlist)
 		{
-		  tail[0] = tail[1];
-		  ++tail;
+		  _dl_main_searchlist->r_list[0]
+		    = _dl_main_searchlist->r_list[1];
+		  ++cnt;
 		}
-	      --_dl_global_scope_end;
+	      --_dl_main_searchlist->r_nlist;
 	    }
 
 	  /* We can unmap all the maps at once.  We determined the
@@ -135,8 +137,6 @@ _dl_close (struct link_map *map)
 #endif
 	  if (imap->l_next)
 	    imap->l_next->l_prev = imap->l_prev;
-	  if (imap->l_searchlist && imap->l_searchlist != list)
-	    free (imap->l_searchlist);
 
 	  if (imap->l_versions != NULL)
 	    free (imap->l_versions);
@@ -156,15 +156,14 @@ _dl_close (struct link_map *map)
 	  while (lnp != NULL);
 
 	  /* Remove the searchlists.  */
-	  if (imap->l_dupsearchlist != imap->l_searchlist)
+	  if (imap->l_searchlist.r_duplist != imap->l_searchlist.r_list)
 	    {
-	      /* If a l_searchlist object exists there always also is
-		 a l_dupsearchlist object.  */
-	      assert (imap->l_dupsearchlist != NULL);
-	      free (imap->l_dupsearchlist);
+	      /* If a r_list exists there always also is a r_duplist.  */
+	      assert (imap->l_searchlist.r_list != NULL);
+	      free (imap->l_searchlist.r_duplist);
 	    }
-	  if (imap != map && imap->l_searchlist != NULL)
-	    free (imap->l_searchlist);
+	  if (imap != map && imap->l_searchlist.r_list != NULL)
+	    free (imap->l_searchlist.r_list);
 
 	  free (imap);
 	}