aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-09 23:40:44 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-09 23:40:44 +0000
commit1393c745813e58e6bfbcb728b471765c4aa6c36f (patch)
tree83a07a633fd4dd0cda77a4ebea698c9b01bd88ff
parent0c367d923b58c146c30acc560c18097bacae91c4 (diff)
downloadglibc-1393c745813e58e6bfbcb728b471765c4aa6c36f.zip
glibc-1393c745813e58e6bfbcb728b471765c4aa6c36f.tar.gz
glibc-1393c745813e58e6bfbcb728b471765c4aa6c36f.tar.bz2
Update.
1998-03-09 23:36 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/init-first.c [!PIC]: Expect arguments in correct format. * sysdeps/unix/sysv/linux/libc-start.c: Call __libc_init_first with correct parameters. [!PIC]: Initialize __libc_multiple_libcs.
-rw-r--r--ChangeLog8
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c10
-rw-r--r--sysdeps/unix/sysv/linux/libc-start.c23
3 files changed, 32 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index c63c207..fef8eca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+1998-03-09 23:36 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/unix/sysv/linux/init-first.c [!PIC]: Expect arguments
+ in correct format.
+ * sysdeps/unix/sysv/linux/libc-start.c: Call __libc_init_first
+ with correct parameters.
+ [!PIC]: Initialize __libc_multiple_libcs.
+
1998-03-09 18:21 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-support.c (_dl_debug_bindings): Add definition.
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index 3a17228..acaf509 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -1,5 +1,5 @@
/* Initialization code run first thing by the ELF startup code. Linux version.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998 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
@@ -97,9 +97,11 @@ __libc_init_first (void)
}
#else
-
-SYSDEP_CALL_INIT(__libc_init_first, init);
-
+void
+__libc_init_first (int argc, char **argv, char **envp)
+{
+ init (argc, argv, envp);
+}
#endif
diff --git a/sysdeps/unix/sysv/linux/libc-start.c b/sysdeps/unix/sysv/linux/libc-start.c
index e9d21a6..5e089d4 100644
--- a/sysdeps/unix/sysv/linux/libc-start.c
+++ b/sysdeps/unix/sysv/linux/libc-start.c
@@ -20,26 +20,39 @@
#include <stdlib.h>
#include <unistd.h>
-extern void __libc_init_first (void);
+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;
int
__libc_start_main (int (*main) (int, char **, char **), int argc,
char **argv, void (*init) (void), void (*fini) (void),
void (*rtld_fini) (void))
{
+#ifndef PIC
+ /* 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
+
/* Register the destructor of the dynamic linker if there is any. */
if (rtld_fini != NULL)
atexit (rtld_fini);
+ /* Set the global _environ variable correctly. */
+ __environ = &argv[argc + 1];
+
/* Call the initializer of the libc. */
#ifdef PIC
if (_dl_debug_impcalls)
_dl_debug_message ("\tinitialize libc\n\n", NULL);
#endif
- __libc_init_first ();
-
- /* Set the global _environ variable correctly. */
- __environ = &argv[argc + 1];
+ __libc_init_first (argc, argv, __environ);
/* Call the initializer of the program. */
#ifdef PIC