[uClibc-cvs] svn commit: trunk/uClibc/ldso/ldso/powerpc

jocke at uclibc.org jocke at uclibc.org
Mon Mar 21 10:40:39 UTC 2005


Author: jocke
Date: 2005-03-21 03:40:38 -0700 (Mon, 21 Mar 2005)
New Revision: 10053

Log:
Prepare for moving ldso FINI handling to libc by passing _dl_fini. This should not break ABI.
Minor cleanup as well.


Modified:
   trunk/uClibc/ldso/ldso/powerpc/dl-startup.h


Changeset:
Modified: trunk/uClibc/ldso/ldso/powerpc/dl-startup.h
===================================================================
--- trunk/uClibc/ldso/ldso/powerpc/dl-startup.h	2005-03-21 02:59:56 UTC (rev 10052)
+++ trunk/uClibc/ldso/ldso/powerpc/dl-startup.h	2005-03-21 10:40:38 UTC (rev 10053)
@@ -10,12 +10,34 @@
     "	.type	_start, at function\n"
     "_start:\n"
     "	mr	3,1\n" /* Pass SP to _dl_start in r3 */
-    "	addi	1,1,-16\n" /* Make room on stack for _dl_start to store LR */
-    "	li	4,0\n"
-    "	stw	4,0(1)\n" /* Clear Stack frame */
+    "	li	0,0\n"
+    "	stwu	1,-16(1)\n" /* Make room on stack for _dl_start to store LR */
+    "	stw	0,0(1)\n" /* Clear Stack frame */
     "	bl	_dl_start at local\n" /* Perform relocation */
+    /*  Save the address of the apps entry point in CTR register */
+    "	mtctr	3\n" /* application entry point */
+    "	bl	_GLOBAL_OFFSET_TABLE_-4 at local\n" /*  Put our GOT pointer in r31, */
+    "	mflr	31\n"
     "	addi	1,1,16\n" /* Restore SP */
-    "	mtctr	3\n" /* Load applications entry point */
+#if 0
+    /* Try beeing SVR4 ABI compliant?, even though it is not needed for uClibc on Linux */
+    /* argc */
+    "	lwz	3,0(1)\n"
+    /* find argv one word offset from the stack pointer */
+    "	addi	4,1,4\n"
+    /* find environment pointer (argv+argc+1) */
+    "	lwz	5,0(1)\n"
+    "	addi	5,5,1\n"
+    "	rlwinm	5,5,2,0,29\n"
+    "	add	5,5,4\n"
+    /* pass the auxilary vector in r6. This is passed to us just after _envp.  */
+    "2:	lwzu	0,4(6)\n"
+    "	cmpwi	0,0\n"
+    "	bne	2b\n"
+    "	addi	6,6,4\n"
+#endif
+    /* Pass a termination function pointer (in this case _dl_fini) in r7.  */
+    "	lwz	7,_dl_fini at got(31)\n"
     "	bctr\n" /* Jump to entry point */
     "	.size	_start,.-_start\n"
     "	.previous\n"




More information about the uClibc-cvs mailing list