[uClibc-cvs] uClibc/ldso/ldso/powerpc boot1_arch.h,1.4,1.5

Erik Andersen andersen at uclibc.org
Tue Jan 20 17:44:19 UTC 2004

Update of /var/cvs/uClibc/ldso/ldso/powerpc
In directory nail:/home/andersen/CVS/uClibc/ldso/ldso/powerpc

Modified Files:
Log Message:
Paul Mundt writes:

The current behavior of the powerpc boot1_arch.h seems somewhat broken.
Currently room is made on the stack pointer for the link register, but the link
register is never actually pushed onto it. glibc bears the following comments:
    /* Call _dl_start with one parameter pointing at argc */                  
            mr      r3,r1
    /* (we have to frob the stack pointer a bit to allow room for
       _dl_start to save the link register).  */                 

followed by the -16 add to r1. Despite the fact that r1 is modified, the link
register is never actually pushed onto r1, thus the adjustment is completely

There's two possible fixes for this, either saving the link register in the way
that glibc does, or getting rid of the r1 adjustment. As I'm not sure if saving
the link register will actually break the _dl_boot2 callin, both options will
probably want to be played with.

The following bit of inline assembly in the attached patch builds cleanly for
me with gcc 3.3 on darwin, but I'm not able to test it any further beyond that.

Index: boot1_arch.h
RCS file: /var/cvs/uClibc/ldso/ldso/powerpc/boot1_arch.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- boot1_arch.h	16 Feb 2003 01:22:41 -0000	1.4
+++ boot1_arch.h	20 Jan 2004 17:44:17 -0000	1.5
@@ -9,8 +9,10 @@
 "	.text\n"			\
 "	.globl	_dl_boot\n"		\
 "_dl_boot:\n"				\
-"	mr	3,1\n"			\
+"	mr	3,1\n"		\
+"	li	4,0\n"			\
 "	addi	1,1,-16\n"		\
+"	stw	4,0(1)\n"		\
 "	bl      _dl_boot2\n"		\
 ".previous\n"				\

More information about the uClibc-cvs mailing list