about summary refs log tree commit diff
path: root/elf/dl-object.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-object.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-object.c')
-rw-r--r--elf/dl-object.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/elf/dl-object.c b/elf/dl-object.c
index db6e81c11e..d9dd692be2 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -25,16 +25,17 @@
 
 #include <assert.h>
 
-/* List of objects currently loaded is [2] of this, aka _dl_loaded.  */
-struct link_map *_dl_default_scope[5];
 
 /* Allocate a `struct link_map' for a new object being loaded,
    and enter it into the _dl_loaded list.  */
 
 struct link_map *
 internal_function
-_dl_new_object (char *realname, const char *libname, int type)
+_dl_new_object (char *realname, const char *libname, int type,
+		struct link_map *loader)
 {
+  struct link_map *l;
+  int idx;
   size_t libname_len = strlen (libname) + 1;
   struct link_map *new = calloc (sizeof *new, 1);
   struct libname_list *newname = malloc (sizeof *newname + libname_len);
@@ -46,26 +47,37 @@ _dl_new_object (char *realname, const char *libname, int type)
   newname->next = NULL;
   new->l_libname = newname;
   new->l_type = type;
+  new->l_loader = loader;
 
-  if (_dl_loaded == NULL)
-    {
-      new->l_prev = new->l_next = NULL;
-      _dl_loaded = new;
-    }
-  else
+  /* Counter for the scopes we have to handle.  */
+  idx = 0;
+
+  if (_dl_loaded != NULL)
     {
-      struct link_map *l = _dl_loaded;
+      l = _dl_loaded;
       while (l->l_next)
 	l = l->l_next;
       new->l_prev = l;
-      new->l_next = NULL;
+      /* new->l_next = NULL;	Would be necesary but we use calloc.  */
       l->l_next = new;
-    }
 
-  /* Don't try to find the origin for the main map.  */
-  if (realname[0] == '\0')
-    new->l_origin = NULL;
+      /* Add the global scope.  */
+      new->l_scope[idx++] = &_dl_loaded->l_searchlist;
+    }
+  /* This is our local scope.  */
+  if (loader != NULL)
+    {
+      while (loader->l_loader != NULL)
+	loader = loader->l_loader;
+      new->l_scope[idx] = &loader->l_searchlist;
+    }
   else
+    new->l_scope[idx] = &new->l_searchlist;
+
+  new->l_local_scope[0] = new->l_scope[idx];
+
+  /* Don't try to find the origin for the main map which has the name "".  */
+  if (realname[0] != '\0')
     {
       char *origin;