From d0c0ebb78efe2fba3132c78c70b26373b4660353 Mon Sep 17 00:00:00 2001
From: David Schleef <ds@schleef.org>
Date: Sat, 26 May 2001 01:39:15 +0000
Subject: Nasty hack to get around inconsistency between dynamic linker entry
 and kernel entry to crt0.o.

---
 libc/sysdeps/linux/powerpc/crt0.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libc/sysdeps/linux/powerpc/crt0.c b/libc/sysdeps/linux/powerpc/crt0.c
index c16bde89f..b7e7f9b15 100644
--- a/libc/sysdeps/linux/powerpc/crt0.c
+++ b/libc/sysdeps/linux/powerpc/crt0.c
@@ -24,7 +24,12 @@
 asm(
 	"\t.global _start\n"
 	"\t_start:\n"
+	//"\tmr 9,1\n"
+	//"\trlwinm 1,1,0,0,27\n"
+	"\tli 0,0\n"
 	"\tstwu	1,-32(1)\n"
+	"\tmtlr 0\n"
+	//"\tstw 0,0(1)\n"
 	"\tb _start2\n");
 
 void __uClibc_main(int argc,void *argv,void *envp);
@@ -34,10 +39,16 @@ void _start2(void)
 	void **p;
 	int argc;
 
-	p=__builtin_frame_address(2);
+	p=__builtin_frame_address(0)+0x30;
 
 	argc=*(int *)p;
 
+	/* gross hack for dynamic linker */
+	if(argc==0){
+		p=((void *)p)+0x10;
+		argc=*(int *)p;
+	}
+
 	__uClibc_main(argc,p+1,p+2+argc);
 }
 
-- 
cgit v1.2.3