about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-10-24 19:14:59 +0000
committerRoland McGrath <roland@gnu.org>2002-10-24 19:14:59 +0000
commit5bbcba0db58cef39ec4b582cd665ccb019dc6763 (patch)
tree5e18843757e510eddaef04aa3213bcb351681319 /sysdeps
parent369b849f1a382df2c1ee5d3a997bf318950cf5ab (diff)
downloadglibc-5bbcba0db58cef39ec4b582cd665ccb019dc6763.tar.gz
glibc-5bbcba0db58cef39ec4b582cd665ccb019dc6763.tar.xz
glibc-5bbcba0db58cef39ec4b582cd665ccb019dc6763.zip
* elf/dl-misc.c: Include <sysdep.h>.
	(_dl_debug_vdprintf): Only take dl_load_lock if not _dl_starting_up.

	* sysdeps/generic/ldsodefs.h (_dl_starting_up): Declare it here.
	* sysdeps/unix/sysv/linux/init-first.c: Not here.
	* sysdeps/powerpc/elf/libc-start.c: Or here.
	* sysdeps/unix/sysv/aix/libc-start.c: Or here.
	* sysdeps/unix/sysv/aix/start-libc.c: Or here.
	* sysdeps/unix/sysv/aix/init-first.c: Or here.
	* sysdeps/generic/libc-start.c: Or here.
	* sysdeps/unix/sysv/linux/init-first.c (init): Protect _dl_starting_up
	access with [! SHARED].
	* sysdeps/unix/sysv/aix/init-first.c (init): Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/ldsodefs.h7
-rw-r--r--sysdeps/generic/libc-start.c2
-rw-r--r--sysdeps/powerpc/elf/libc-start.c3
-rw-r--r--sysdeps/unix/sysv/aix/init-first.c5
-rw-r--r--sysdeps/unix/sysv/aix/libc-start.c2
-rw-r--r--sysdeps/unix/sysv/aix/start-libc.c2
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c6
7 files changed, 12 insertions, 15 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 36582a7463..a8f006122b 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -416,6 +416,13 @@ extern const char _dl_out_of_memory[];
 extern const char _dl_out_of_memory_internal[] attribute_hidden;
 #endif
 
+#ifndef SHARED
+/* Flag set at startup and cleared when the last initializer has run.  */
+extern int _dl_starting_up;
+weak_extern (_dl_starting_up)
+#elif defined IS_IN_rtld
+extern int _dl_starting_up_internal attribute_hidden;
+#endif
 
 /* OS-dependent function to open the zero-fill device.  */
 extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
index 3c7f2fa639..806ed789cc 100644
--- a/sysdeps/generic/libc-start.c
+++ b/sysdeps/generic/libc-start.c
@@ -24,8 +24,6 @@
 
 extern void __libc_init_first (int argc, char **argv, char **envp);
 
-extern int _dl_starting_up;
-weak_extern (_dl_starting_up)
 extern int __libc_multiple_libcs;
 extern void *__libc_stack_end;
 
diff --git a/sysdeps/powerpc/elf/libc-start.c b/sysdeps/powerpc/elf/libc-start.c
index 6751b9ea06..4878979f43 100644
--- a/sysdeps/powerpc/elf/libc-start.c
+++ b/sysdeps/powerpc/elf/libc-start.c
@@ -24,9 +24,6 @@
 
 extern void __libc_init_first (int argc, char **argv, char **envp);
 
-extern int _dl_starting_up;
-weak_extern (_dl_starting_up)
-
 extern int __cache_line_size;
 weak_extern (__cache_line_size)
 
diff --git a/sysdeps/unix/sysv/aix/init-first.c b/sysdeps/unix/sysv/aix/init-first.c
index 4c6768b8ad..8272a62824 100644
--- a/sysdeps/unix/sysv/aix/init-first.c
+++ b/sysdeps/unix/sysv/aix/init-first.c
@@ -37,9 +37,6 @@ extern void __libc_init (int, char **, char **);
 /* The function is called from assembly stubs the compiler can't see.  */
 static void init (int, char **, char **) __attribute__ ((unused));
 
-extern int _dl_starting_up;
-weak_extern (_dl_starting_up)
-
 /* Set nonzero if we have to be prepared for more then one libc being
    used in the process.  Safe assumption if initializer never runs.  */
 int __libc_multiple_libcs attribute_hidden = 1;
@@ -60,10 +57,12 @@ init (int argc, char **argv, char **envp)
      If the address would be taken inside the expression the optimizer
      would try to be too smart and throws it away.  Grrr.  */
 
+#ifndef SHARED
   /* XXX disable dl for now
   int *dummy_addr = &_dl_starting_up;
 
   __libc_multiple_libcs = dummy_addr && !_dl_starting_up; */
+#endif
 
   /* Save the command-line arguments.  */
   __libc_argc = argc;
diff --git a/sysdeps/unix/sysv/aix/libc-start.c b/sysdeps/unix/sysv/aix/libc-start.c
index 757b34975c..813e28d09b 100644
--- a/sysdeps/unix/sysv/aix/libc-start.c
+++ b/sysdeps/unix/sysv/aix/libc-start.c
@@ -31,8 +31,6 @@ typedef unsigned char uchar;
 extern void __libc_init_first (int argc, char **argv, char **envp);
 
 /* XXX disable for now
-extern int _dl_starting_up;
-weak_extern (_dl_starting_up)
 extern int __libc_multiple_libcs; */
 
 /* XXX normally defined in generic/dl-sydep.c, hack it into existance
diff --git a/sysdeps/unix/sysv/aix/start-libc.c b/sysdeps/unix/sysv/aix/start-libc.c
index 303caa7078..0cbe79d0b1 100644
--- a/sysdeps/unix/sysv/aix/start-libc.c
+++ b/sysdeps/unix/sysv/aix/start-libc.c
@@ -31,8 +31,6 @@ typedef unsigned char uchar;
 extern void __libc_init_first (int argc, char **argv, char **envp);
 
 /* XXX disable for now
-extern int _dl_starting_up;
-weak_extern (_dl_starting_up)
 extern int __libc_multiple_libcs; */
 
 /* XXX normally defined in generic/dl-sydep.c, hack it into existance
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index e644b29eda..a2905f9392 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -35,9 +35,6 @@
 /* The function is called from assembly stubs the compiler can't see.  */
 static void init (int, char **, char **) __attribute__ ((unused));
 
-extern int _dl_starting_up;
-weak_extern (_dl_starting_up)
-
 /* Set nonzero if we have to be prepared for more then one libc being
    used in the process.  Safe assumption if initializer never runs.  */
 int __libc_multiple_libcs attribute_hidden = 1;
@@ -54,12 +51,15 @@ init (int argc, char **argv, char **envp)
 #ifdef USE_NONOPTION_FLAGS
   extern void __getopt_clean_environment (char **);
 #endif
+
+#ifndef SHARED
   /* The next variable is only here to work around a bug in gcc <= 2.7.2.2.
      If the address would be taken inside the expression the optimizer
      would try to be too smart and throws it away.  Grrr.  */
   int *dummy_addr = &_dl_starting_up;
 
   __libc_multiple_libcs = dummy_addr && !_dl_starting_up;
+#endif
 
   /* Make sure we don't initialize twice.  */
   if (!__libc_multiple_libcs)