about summary refs log tree commit diff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-01-31 03:41:25 +0000
committerUlrich Drepper <drepper@redhat.com>2002-01-31 03:41:25 +0000
commitd6b5d570a3255d8dc80e07c3674594574cd98fe7 (patch)
tree36e05b0d065614559820d2a4f43bb1076ea5cfa1 /elf/dl-open.c
parent1b4575aefaaa43adfed4658f7d66de587f12120e (diff)
downloadglibc-d6b5d570a3255d8dc80e07c3674594574cd98fe7.tar.gz
glibc-d6b5d570a3255d8dc80e07c3674594574cd98fe7.tar.xz
glibc-d6b5d570a3255d8dc80e07c3674594574cd98fe7.zip
Update.
2002-01-30  Ulrich Drepper  <drepper@redhat.com>

	* Versions.def [ld]: Add GLIBC_2.3.
	* elf/dl-addr.c: Move global variables for SHARED code in struct
	_rtld_global.  Export this struct, remove all exports for the
	signal variables.
	* elf/dl-close.c: Likewise.
	* elf/dl-conflict.c: Likewise.
	* elf/dl-debug.c: Likewise.
	* elf/dl-deps.c: Likewise.
	* elf/dl-dst.h: Likewise.
	* elf/dl-error.c: Likewise.
	* elf/dl-fini.c: Likewise.
	* elf/dl-init.c: Likewise.
	* elf/dl-iteratephdr.c: Likewise.
	* elf/dl-libc.c: Likewise.
	* elf/dl-load.c: Likewise.
	* elf/dl-lookup.c: Likewise.
	* elf/dl-minimal.c: Likewise.
	* elf/dl-object.c: Likewise.
	* elf/dl-open.c: Likewise.
	* elf/dl-profile.c: Likewise.
	* elf/dl-profstub.c: Likewise.
	* elf/dl-reloc.c: Likewise.
	* elf/dl-runtime.c: Likewise.
	* elf/dl-support.c: Likewise.
	* elf/dl-sym.c: Likewise.
	* elf/dl-version.c: Likewise.
	* elf/do-lookup.h: Likewise.
	* elf/do-rel.h: Likewise.
	* elf/dynamic-link.h: Likewise.
	* elf/rtld.c: Likewise.
	* sysdeps/generic/dl-cache.c: Likewise.
	* sysdeps/generic/dl-sysdep.c: Likewise.
	* sysdeps/generic/ldsodefs.h: Likewise.
	* sysdeps/generic/libc-start.c: Likewise.
	* sysdeps/i386/dl-machine.h: Likewise.
	* sysdeps/ia64/dl-fptr.c: Likewise.
	* sysdeps/ia64/dl-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/dl-librecon.h: Likewise.
	* sysdeps/unix/sysv/linux/dl-origin.c: Likewise.
	* sysdeps/unix/sysv/linux/dl-osinfo.h: Likewise.
	* sysdeps/unix/sysv/linux/getclktck.c: Likewise.
	* sysdeps/unix/sysv/linux/getpagesize.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/dl-static.c: Likewise.
	* sysdeps/unix/sysv/linux/ia64/getpagesize.c: Likewise.

	* malloc/thread-m.h: Spinlock definitions for x86/x86_64.
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index c061cdeb0e..2f82e4cf40 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -1,5 +1,5 @@
 /* Load a shared object at runtime, relocate it, and run its initializer.
-   Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+   Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -50,16 +50,12 @@ extern char **__libc_argv;
 
 extern char **__environ;
 
-extern int _dl_lazy;			/* Do we do lazy relocations?  */
-
 /* Undefine the following for debugging.  */
 /* #define SCOPE_DEBUG 1 */
 #ifdef SCOPE_DEBUG
 static void show_scope (struct link_map *new);
 #endif
 
-extern size_t _dl_platformlen;
-
 /* We must be carefull not to leave us in an inconsistent state.  Thus we
    catch any error and re-raise it after cleaning up.  */
 
@@ -98,15 +94,15 @@ add_to_global (struct link_map *new)
      in an realloc() call.  Therefore we allocate a completely new
      array the first time we have to add something to the locale scope.  */
 
-  if (_dl_global_scope_alloc == 0)
+  if (GL(dl_global_scope_alloc) == 0)
     {
       /* This is the first dynamic object given global scope.  */
-      _dl_global_scope_alloc = _dl_main_searchlist->r_nlist + to_add + 8;
+      GL(dl_global_scope_alloc) = GL(dl_main_searchlist)->r_nlist + to_add + 8;
       new_global = (struct link_map **)
-	malloc (_dl_global_scope_alloc * sizeof (struct link_map *));
+	malloc (GL(dl_global_scope_alloc) * sizeof (struct link_map *));
       if (new_global == NULL)
 	{
-	  _dl_global_scope_alloc = 0;
+	  GL(dl_global_scope_alloc) = 0;
 	nomem:
 	  _dl_signal_error (ENOMEM, new->l_libname->name, NULL,
 			    N_("cannot extend global scope"));
@@ -114,24 +110,25 @@ add_to_global (struct link_map *new)
 	}
 
       /* Copy over the old entries.  */
-      memcpy (new_global, _dl_main_searchlist->r_list,
-	      (_dl_main_searchlist->r_nlist * sizeof (struct link_map *)));
+      memcpy (new_global, GL(dl_main_searchlist)->r_list,
+	      (GL(dl_main_searchlist)->r_nlist * sizeof (struct link_map *)));
 
-      _dl_main_searchlist->r_list = new_global;
+      GL(dl_main_searchlist)->r_list = new_global;
     }
-  else if (_dl_main_searchlist->r_nlist + to_add > _dl_global_scope_alloc)
+  else if (GL(dl_main_searchlist)->r_nlist + to_add
+	   > GL(dl_global_scope_alloc))
     {
       /* We have to extend the existing array of link maps in the
 	 main map.  */
       new_global = (struct link_map **)
-	realloc (_dl_main_searchlist->r_list,
-		 ((_dl_global_scope_alloc + to_add + 8)
+	realloc (GL(dl_main_searchlist)->r_list,
+		 ((GL(dl_global_scope_alloc) + to_add + 8)
 		  * sizeof (struct link_map *)));
       if (new_global == NULL)
 	goto nomem;
 
-      _dl_global_scope_alloc += to_add + 8;
-      _dl_main_searchlist->r_list = new_global;
+      GL(dl_global_scope_alloc) += to_add + 8;
+      GL(dl_main_searchlist)->r_list = new_global;
     }
 
   /* Now add the new entries.  */
@@ -142,8 +139,9 @@ add_to_global (struct link_map *new)
       if (map->l_global == 0)
 	{
 	  map->l_global = 1;
-	  _dl_main_searchlist->r_list[_dl_main_searchlist->r_nlist] = map;
-	  ++_dl_main_searchlist->r_nlist;
+	  GL(dl_main_searchlist)->r_list[GL(dl_main_searchlist)->r_nlist]
+	    = map;
+	  ++GL(dl_main_searchlist)->r_nlist;
 	}
     }
 
@@ -180,7 +178,7 @@ dl_open_worker (void *a)
 
       /* We have to find out from which object the caller is calling.  */
       call_map = NULL;
-      for (l = _dl_loaded; l; l = l->l_next)
+      for (l = GL(dl_loaded); l; l = l->l_next)
 	if (caller >= (const void *) l->l_map_start
 	    && caller < (const void *) l->l_map_end)
 	  {
@@ -192,7 +190,7 @@ dl_open_worker (void *a)
 
       if (call_map == NULL)
 	/* In this case we assume this is the main application.  */
-	call_map = _dl_loaded;
+	call_map = GL(dl_loaded);
 
       /* Determine how much space we need.  We have to allocate the
 	 memory locally.  */
@@ -233,7 +231,7 @@ dl_open_worker (void *a)
   if (new->l_searchlist.r_list != NULL)
     {
       /* Let the user know about the opencount.  */
-      if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
+      if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0))
 	_dl_debug_printf ("opening file=%s; opencount == %u\n\n",
 			  new->l_name, new->l_opencount);
 
@@ -274,20 +272,20 @@ dl_open_worker (void *a)
       if (! l->l_relocated)
 	{
 #ifdef SHARED
-	  if (_dl_profile != NULL)
+	  if (GL(dl_profile) != NULL)
 	    {
 	      /* If this here is the shared object which we want to profile
 		 make sure the profile is started.  We can find out whether
 	         this is necessary or not by observing the `_dl_profile_map'
 	         variable.  If was NULL but is not NULL afterwars we must
 		 start the profiling.  */
-	      struct link_map *old_profile_map = _dl_profile_map;
+	      struct link_map *old_profile_map = GL(dl_profile_map);
 
 	      _dl_relocate_object (l, l->l_scope, 1, 1);
 
-	      if (old_profile_map == NULL && _dl_profile_map != NULL)
+	      if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
 		/* We must prepare the profiling.  */
-		_dl_start_profile (_dl_profile_map, _dl_profile_output);
+		_dl_start_profile (GL(dl_profile_map), GL(dl_profile_output));
 	    }
 	  else
 #endif
@@ -382,7 +380,7 @@ dl_open_worker (void *a)
     __libc_multiple_libcs = 1;
 
   /* Let the user know about the opencount.  */
-  if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
+  if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0))
     _dl_debug_printf ("opening file=%s; opencount == %u\n\n",
 		      new->l_name, new->l_opencount);
 }