[uClibc-cvs] uClibc/libc/sysdeps/linux/sh crt0.S,1.8,1.9

Erik Andersen andersen at codepoet.org
Wed Nov 27 23:34:28 UTC 2002


Update of /var/cvs/uClibc/libc/sysdeps/linux/sh
In directory winder:/tmp/cvs-serv365/libc/sysdeps/linux/sh

Modified Files:
	crt0.S 
Log Message:
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


Index: crt0.S
===================================================================
RCS file: /var/cvs/uClibc/libc/sysdeps/linux/sh/crt0.S,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- crt0.S	1 Oct 2002 05:30:15 -0000	1.8
+++ crt0.S	27 Nov 2002 23:33:55 -0000	1.9
@@ -48,6 +48,34 @@
 	mov.l @r15+,r4
 	mov r15, r5
 
+#if ! defined __UCLIBC_CTOR_DTOR__
+	/*
+	 * Setup the value for the environment pointer:
+	 * r6 = (argc + 1) * 4
+	 * r6 += argv (in delay slot)
+	 */
+	mov r4,r6
+	add #1,r6
+	shll2 r6
+	add r5, r6
+
+	/* jump to __uClibc_main (argc, argv, envp) */
+	mov.l L_main, r0
+	jsr @r0
+	nop /* delay slot */
+
+	/* We should not get here. */
+	mov.l L_abort, r0
+	jmp @r0
+	nop
+
+_start_end:	
+	.align	2
+
+L_main:
+	.long   __uClibc_main /* in libuClibc.*.so */
+
+#else /* __UCLIBC_CTOR_DTOR__ */
 	/* Push the finip argument to __uClibc_start_main() onto the stack */
 	mov.l L_fini,r6
 	mov.l r6, at -r15
@@ -72,10 +100,12 @@
 	mov.l L_abort, r0
 	jmp @r0
 	nop
-
 _start_end:	
 	.align	2
 
+L_main:
+	.long   __uClibc_start_main /* in libuClibc.*.so */
+
 	.weak   _init
 	.type   _init, at function
 _init:
@@ -87,13 +117,13 @@
 	.weak   _fini
 	.set    _fini,_init
 
-L_main:
-	.long   __uClibc_start_main /* in libuClibc.*.so */
-
 L_init:
       .long   _init
 L_fini:
       .long   _fini
+
+#endif
+
 L_abort: 
       .long   abort   
 




More information about the uClibc-cvs mailing list