summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorDavid McCullough <davidm@snapgear.com>2001-02-26 03:57:47 +0000
committerDavid McCullough <davidm@snapgear.com>2001-02-26 03:57:47 +0000
commit8c9907105a05e122e47b8d5c93b1156ba892f2ea (patch)
treef2894dce6401b444422113883aadddbc292af9f0 /libc
parentec656c14290dfe1449d3a03925ab4085bfc71ccd (diff)
New crt0.S with all init done in 'C' code.
Added in support for C++ contructor/destructor tables.
Diffstat (limited to 'libc')
-rw-r--r--libc/sysdeps/linux/m68k/crt0.S63
1 files changed, 33 insertions, 30 deletions
diff --git a/libc/sysdeps/linux/m68k/crt0.S b/libc/sysdeps/linux/m68k/crt0.S
index c2e8a6c60..e7de07322 100644
--- a/libc/sysdeps/linux/m68k/crt0.S
+++ b/libc/sysdeps/linux/m68k/crt0.S
@@ -18,50 +18,53 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
/*
- * NOTE: this file works for PIC and non-PIC code. Be very careful how
- * you modify it !
+ * NOTE: this file works for PIC and non-PIC code. Be very careful how
+ * you modify it !
*/
.global _start
- .global __main
- .global _end
- .global _sdata
-
- .bss
- .global environ
-environ:
- .long 0
+ .global __exit
+ .global atexit
.text
-_start: /* renamed from __start */
+
nop
nop
+_start: /* put here so that references to _start work with elf-PIC */
movea.l %d5, %a5 /* uClinux passes in data segment here */
-
- move.l 8(%sp), %d5
-
- lea.l _sdata, %a1 /* set environ to point to the right place */
- lea.l environ, %a0
- sub.l %a1, %a0
- move.l %d5, %a5@(%a0)
-
- lea main-.-8, %a0 /* call main */
+/*
+ * argc, argv and envp are on the stack, just call to main
+ */
+ lea __uClibc_main-.-8, %a0 /* call uClibc main */
jsr %pc@(%a0)
- move.l %d0,%sp@-
-
- lea exit-.-8, %a0 /* call the exit routine */
- jsr %pc@(%a0)
-
-#ifdef NO_LIBGCC
/* If that didn't kill us, ... */
-_exit:
+__exit:
move.l %sp@+,%d1
moveq #1,%d0 /* SYS_exit */
trap #0
-__main:
+/*
+ * this was needed for gcc/g++-builds, atexit was not getting included
+ * for some stupid reason, this gets us a compiler
+ */
+empty_func:
rts
-#else
+ .weak atexit
+atexit = empty_func
+
+/*
+ * a little bit of stuff to support C++
+ */
+ .section .ctors,"aw"
+ .align 4
+ .global __CTOR_LIST__
+__CTOR_LIST__:
+ .long -1
+
+ .section .dtors,"aw"
+ .align 4
+ .global __DTOR_LIST__
+__DTOR_LIST__:
+ .long -1
-#endif /* NO_LIBGCC */