[uClibc-cvs] r9826 - in trunk/uClibc/libc/sysdeps/linux/cris: .
uclibc at mail.uclibc.org
uclibc at mail.uclibc.org
Wed Feb 9 08:42:14 UTC 2005
Author: pkj
Date: 2005-02-09 01:42:13 -0700 (Wed, 09 Feb 2005)
New Revision: 9826
Log:
Implement _start completely in assembler. Otherwise the compiler will
push the frame pointer when DO_DEBUG is enabled (and thus incorrect
argc, argv and envp will be passed to the program).
Modified:
trunk/uClibc/libc/sysdeps/linux/cris/crt0.c
Changeset:
Modified: trunk/uClibc/libc/sysdeps/linux/cris/crt0.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/cris/crt0.c 2005-02-09 08:40:55 UTC (rev 9825)
+++ trunk/uClibc/libc/sysdeps/linux/cris/crt0.c 2005-02-09 08:42:13 UTC (rev 9826)
@@ -8,23 +8,27 @@
/*
* It is important that this be the first function.
* This file is the first thing in the text section.
+ * This is implemented completely in assembler to avoid that the
+ * compiler pushes stuff on the stack (e.g. the frame pointer when
+ * debuging).
*/
-void
-_start (void)
-{
- /*
- * On the stack we have argc. We can calculate argv/envp
- * from that and the succeeding stack location, but fix so
- * we get the right calling convention (regs in r10/r11).
- *
- * Please view linux/fs/binfmt_elf.c for a complete
- * understanding of this.
- */
- __asm__ volatile("pop $r10");
- __asm__ volatile("move.d $sp, $r11");
- __asm__ volatile("jump start1");
-}
+/*
+ * On the stack we have argc. We can calculate argv/envp
+ * from that and the succeeding stack location, but fix so
+ * we get the right calling convention (regs in r10/r11).
+ *
+ * Please view linux/fs/binfmt_elf.c for a complete
+ * understanding of this.
+ */
+__asm__ ( \
+ ".text\n\t" \
+ ".global _start\n\t" \
+ "_start:\n\t" \
+ "pop $r10\n\t" \
+ "move.d $sp, $r11\n\t" \
+ "jump start1\n\t");
+
#include <features.h>
extern void __uClibc_main(int argc, char **argv, char **envp)
More information about the uClibc-cvs
mailing list