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/mips | |
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/mips')
-rw-r--r-- | libc/sysdeps/linux/mips/crt0.S | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/mips/crt0.S b/libc/sysdeps/linux/mips/crt0.S index 6770ab0b1..7ff3b253f 100644 --- a/libc/sysdeps/linux/mips/crt0.S +++ b/libc/sysdeps/linux/mips/crt0.S @@ -30,9 +30,22 @@ __start: addu a2, a0, 1 /* load envp */ sll a2, a2, 2 add a2, a2, a1 + + /* Store the address of _init in a3 as an argument to __uClibc_start_main() */ + la a3, _init + + /* Push _fini onto the stack as the final argument to __uClibc_start_main() + I don't think I am doing this properly but it at least compiles... + */ + la t0, _fini + sw t0,16(sp) + /* Ok, now run uClibc's main() -- shouldn't return */ - jal __uClibc_main - hlt: b hlt /* Crash if somehow it does return. */ + jal __uClibc_start_main + + /* Crash if somehow `exit' returns anyways. */ +hlt: + b hlt /* Stick in a dummy reference to main(), so that if an application * is linking when the main() function is in a static library (.a) |