aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-05-28 21:04:20 +0000
committerUlrich Drepper <drepper@redhat.com>2003-05-28 21:04:20 +0000
commitd49c05e00f2b50f7a3e81f13803bdb34bd1970f7 (patch)
tree8a468d6eed4a375cffb6b13fcc8fa48462e7cb40
parent862ef982729737b873b52039714ca7b4b43b4c72 (diff)
downloadglibc-d49c05e00f2b50f7a3e81f13803bdb34bd1970f7.zip
glibc-d49c05e00f2b50f7a3e81f13803bdb34bd1970f7.tar.gz
glibc-d49c05e00f2b50f7a3e81f13803bdb34bd1970f7.tar.bz2
Make code compilable with SHARED.
-rw-r--r--sysdeps/x86_64/elf/start.S14
1 files changed, 13 insertions, 1 deletions
diff --git a/sysdeps/x86_64/elf/start.S b/sysdeps/x86_64/elf/start.S
index 6e3fb26..8762b76 100644
--- a/sysdeps/x86_64/elf/start.S
+++ b/sysdeps/x86_64/elf/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the ELF x86-64 ABI.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2001.
@@ -74,6 +74,17 @@ _start:
which grow downwards). */
pushq %rsp
+#ifdef SHARED
+ /* Pass address of our own entry points to .fini and .init. */
+ movq __libc_csu_fini@GOTPCREL(%rip), %r8
+ movq __libc_csu_init@GOTPCREL(%rip), %rcx
+
+ movq BP_SYM (main)@GOTPCREL(%rip), %rdi
+
+ /* Call the user's main function, and exit with its value.
+ But let the libc call main. */
+ call BP_SYM (__libc_start_main)@PLT
+#else
/* Pass address of our own entry points to .fini and .init. */
movq $__libc_csu_fini, %r8
movq $__libc_csu_init, %rcx
@@ -83,6 +94,7 @@ _start:
/* Call the user's main function, and exit with its value.
But let the libc call main. */
call BP_SYM (__libc_start_main)
+#endif
hlt /* Crash if somehow `exit' does return. */