aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-06 17:21:43 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-06 17:21:43 +0000
commit7dea968e78d0903e5f6069f2bf72a9961f49465f (patch)
tree20dd8ba18cd1960f9c60d8ae73adea86de2a253e /sysdeps
parent4b7814cf8a55c034f34e02c14207bb271b3aee50 (diff)
downloadglibc-7dea968e78d0903e5f6069f2bf72a9961f49465f.zip
glibc-7dea968e78d0903e5f6069f2bf72a9961f49465f.tar.gz
glibc-7dea968e78d0903e5f6069f2bf72a9961f49465f.tar.bz2
Update.
1998-03-06 17:04 Ulrich Drepper <drepper@cygnus.com> * libc.map: Add _dl_debug_impcalls, _dl_debug_fd, _dl_sysdep_output, __libc_start_main. * csu/Makefile (routines): Add libc-start. * elf/dl-error.c: Remove declaration of _dl_argv. Include <unitsd.h>. * elf/dl-lookup.c: Likewise. * elf/dl-version.c: Likewise. * sysdeps/i386/dl-machine.h: Likewise. * elf/link.h: Declare _dl_argv, _dl_debug_fd. Declare _dl_sysdep_output. Make _dl_sysdep_fatal, _dl_sysdep_error and _dl_sysdep_message macros which use _dl_sysdep_output. * elf/dl-fini.c: Write out which destructor is called while debugging. * elf/dl-init.c: Likewise for constructor. * elf/dl-load.c: Use _dl_debug_message instead of _dl_sysdep_message. * elf/dl-misc.c: Remove _dl_sysdep_fatal, _dl_sysdep_error and _dl_sysdep_message. Add _dl_sysdep_output. * elf/rtld.c: Recognize LD_DEBUG_OUTPUT. Set _dl_debug_fd if this file can be opened. For LD_DEBUG=libs also set _dl_debug_impcalls. * sysdeps/generic/dl-cache.c: Include unistd.h. * sysdeps/generic/libc-start.c: New file. * sysdeps/i386/elf/start.S: Don't call main directly, call * sysdeps/unix/sysv/linux/libc-start.c: New file. __libc_start_main instead. * elf/Makefile ($(objpfx)ld.so): Add $(load-map-file) as dependency.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/dl-cache.c2
-rw-r--r--sysdeps/generic/libc-start.c24
-rw-r--r--sysdeps/i386/dl-machine.h4
-rw-r--r--sysdeps/i386/elf/start.S8
-rw-r--r--sysdeps/unix/sysv/linux/libc-start.c31
5 files changed, 62 insertions, 7 deletions
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c
index 43a987a..2a2be57 100644
--- a/sysdeps/generic/dl-cache.c
+++ b/sysdeps/generic/dl-cache.c
@@ -18,7 +18,7 @@
Boston, MA 02111-1307, USA. */
#include <link.h>
-#include <stddef.h>
+#include <unistd.h>
#include <sys/mman.h>
/* System-dependent function to read a file's whole contents
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
new file mode 100644
index 0000000..1241988
--- /dev/null
+++ b/sysdeps/generic/libc-start.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 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
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+int
+__libc_start_main (int (*main) (int, char **, char **), int argc,
+ char **argv, char **envp)
+{
+ return (*main) (argc, argv, envp);
+}
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 2aaa5b7..394188d 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. i386 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
@@ -302,8 +302,6 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
#ifdef RESOLVE
-extern char **_dl_argv;
-
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
diff --git a/sysdeps/i386/elf/start.S b/sysdeps/i386/elf/start.S
index 7416c0a..e8ed204 100644
--- a/sysdeps/i386/elf/start.S
+++ b/sysdeps/i386/elf/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the ELF i386 ABI.
- 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
@@ -88,9 +88,11 @@ _start:
call atexit
popl %eax
- /* Call the user's main function, and exit with its value. */
- call main
+ /* Call the user's main function, and exit with its value.
+ But let the libc call main. */
+ movl $main, %eax
pushl %eax
+ call __libc_start_main
call exit
hlt /* Crash if somehow `exit' does return. */
diff --git a/sysdeps/unix/sysv/linux/libc-start.c b/sysdeps/unix/sysv/linux/libc-start.c
new file mode 100644
index 0000000..f142195
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/libc-start.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 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
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <link.h>
+
+int
+__libc_start_main (int (*main) (int, char **, char **), int argc,
+ char **argv, char **envp)
+{
+#ifdef PIC
+ if (_dl_debug_impcalls)
+ _dl_debug_message ("\ttransferring control: ", argv[0], "\n\n", NULL);
+#endif
+
+ return (*main) (argc, argv, envp);
+}