diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-10-01 05:30:25 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-10-01 05:30:25 +0000 |
commit | b58a631942341b6ccb62ab400e862f404e22dbbf (patch) | |
tree | 0c6e622729b6c98417a15c0b7c10279c17ca0038 /libc/sysdeps/linux/i386/crt0.S | |
parent | 351c1d9029844a97d2771da883fc2b432d5e1bd4 (diff) |
This commit contains a patch from Stefan Allius <allius@atecom.com> to change
how uClibc handles _init and _fini, allowing shared lib constructors and
destructors to initialize things in the correct sequence. Stefan ported the SH
architecture. I then ported x86, arm, and mips. x86 and arm are working fine,
but I don't think I quite got things correct for mips.
Diffstat (limited to 'libc/sysdeps/linux/i386/crt0.S')
-rw-r--r-- | libc/sysdeps/linux/i386/crt0.S | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/libc/sysdeps/linux/i386/crt0.S b/libc/sysdeps/linux/i386/crt0.S index 3623fe821..97f1fde63 100644 --- a/libc/sysdeps/linux/i386/crt0.S +++ b/libc/sysdeps/linux/i386/crt0.S @@ -33,11 +33,11 @@ Cambridge, MA 02139, USA. */ .text .align 4 -.globl _start - .type _start,@function + .globl _start + .type _start,@function _start: - /* First locate the start of the environment variables */ + /* locate the start of the environment variables */ popl %ecx /* Store argc into %ecx */ movl %esp,%ebx /* Store argv into ebx */ movl %esp,%eax /* Store argv into eax as well*/ @@ -52,7 +52,6 @@ _start: %eax = env ; argv + (argc * 4) + 4 */ - /* Set up an invalid (NULL return address, NULL frame pointer) callers stack frame so anybody unrolling the stack knows where to stop */ @@ -62,20 +61,18 @@ _start: pushl %ebp /* callers %ebp (frame pointer) */ movl %esp,%ebp /* mark callers stack frame as invalid */ - /* Now set the environment, argc, and argv where the app can get to them */ - pushl %eax /* Environment pointer */ - pushl %ebx /* Argument pointer */ - pushl %ecx /* And the argument count */ + /* Push .init and .fini arguments to __uClibc_start_main() on the stack */ + pushl $_fini + pushl $_init -#if 0 - /* Make sure we are not using iBCS2 personality. (i.e. force linux). */ - movl $136,%eax - sub %ebx,%ebx - int $0x80 -#endif + /* Push envp, argc, and argc arguments to __uClibc_start_main() on the stack */ + pushl %eax /* Environment pointer */ + pushl %ebx /* Argument pointer */ + pushl %ecx /* And the argument count */ /* Ok, now run uClibc's main() -- shouldn't return */ - call __uClibc_main + call __uClibc_start_main + /* Crash if somehow `exit' returns anyways. */ hlt |