summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/i386/crt0.S
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-11-27 23:34:07 +0000
committerEric Andersen <andersen@codepoet.org>2002-11-27 23:34:07 +0000
commitae35d725cf586347b2adb1a6fe4216e70fce16cf (patch)
tree9fcdb86297695c3324e386e483e85db53133b412 /libc/sysdeps/linux/i386/crt0.S
parent44c91e654102116f99f80635c483db49126730e8 (diff)
Make support for global constructors and global destructors be
configurable, so people who do not need or want ctor/dtor support can disable it and make their binaries a little bit smaller. -Erik
Diffstat (limited to 'libc/sysdeps/linux/i386/crt0.S')
-rw-r--r--libc/sysdeps/linux/i386/crt0.S9
1 files changed, 9 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/i386/crt0.S b/libc/sysdeps/linux/i386/crt0.S
index 97f1fde63..be66b9a2d 100644
--- a/libc/sysdeps/linux/i386/crt0.S
+++ b/libc/sysdeps/linux/i386/crt0.S
@@ -61,6 +61,7 @@ _start:
pushl %ebp /* callers %ebp (frame pointer) */
movl %esp,%ebp /* mark callers stack frame as invalid */
+#ifdef __UCLIBC_CTOR_DTOR__
/* Push .init and .fini arguments to __uClibc_start_main() on the stack */
pushl $_fini
pushl $_init
@@ -72,6 +73,14 @@ _start:
/* Ok, now run uClibc's main() -- shouldn't return */
call __uClibc_start_main
+#else
+ /* 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 */
+
+ call __uClibc_main
+#endif
/* Crash if somehow `exit' returns anyways. */
hlt