aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-05-28 19:56:24 +0000
committerUlrich Drepper <drepper@redhat.com>2003-05-28 19:56:24 +0000
commitbc4647a17c3218bac51c4ed69757d4b72a2ea1dc (patch)
treeb07ba908ecaeade0a1325d1f9f035731ad345d66 /sysdeps/i386
parent40a54e4d8d66e81a2a5dd5de020ae97cd0019b01 (diff)
downloadglibc-bc4647a17c3218bac51c4ed69757d4b72a2ea1dc.tar
glibc-bc4647a17c3218bac51c4ed69757d4b72a2ea1dc.tar.gz
glibc-bc4647a17c3218bac51c4ed69757d4b72a2ea1dc.tar.bz2
glibc-bc4647a17c3218bac51c4ed69757d4b72a2ea1dc.zip
Update.
2003-05-28 Ulrich Drepper <drepper@redhat.com> * include/libc-symbols.h: Define hidden attribute for real also if LIBC_NONSHARED is defined. Patch by Jakub Jelinek. * csu/Makefile: Add rules to build Scrt1.o. * sysdeps/i386/elf/start.S: Make code compilable with SHARED.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/elf/start.S29
1 files changed, 28 insertions, 1 deletions
diff --git a/sysdeps/i386/elf/start.S b/sysdeps/i386/elf/start.S
index 355cba21a1..8a4fc36157 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,1998,2000,2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998,2000,2001,2002,2003 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
@@ -67,6 +67,27 @@ _start:
pushl %edx /* Push address of the shared library
termination function. */
+#ifdef SHARED
+ /* Load PIC register. */
+ call 1f
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+
+ /* Push address of our own entry points to .fini and .init. */
+ leal __libc_csu_fini@GOTOFF(%ebx), %eax
+ pushl %eax
+ leal __libc_csu_init@GOTOFF(%ebx), %eax
+ pushl %eax
+
+ pushl %ecx /* Push second argument: argv. */
+ pushl %esi /* Push first argument: argc. */
+
+ leal BP_SYM (main)@GOTOFF(%ebx), %eax
+ pushl %eax
+
+ /* 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
/* Push address of our own entry points to .fini and .init. */
pushl $__libc_csu_fini
pushl $__libc_csu_init
@@ -79,9 +100,15 @@ _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. */
+#ifdef SHARED
+1: movl (%esp), %ebx
+ ret
+#endif
+
/* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so
meaningless since we don't support machines < 80386. */
.section .rodata