From d49c05e00f2b50f7a3e81f13803bdb34bd1970f7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 28 May 2003 21:04:20 +0000 Subject: [PATCH] Make code compilable with SHARED. --- sysdeps/x86_64/elf/start.S | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 , 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. */ -- 2.7.4