Port-powerpc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Bad powerpc code with GCC 4.5.3?



Rados?aw Kujawa wrote:

> Machine code generated by 4.5 is sometimes very different from 4.1...
> I'm not fluent enough in PPC asm to quicky spot the problem here. The
> answer might lie somewhere in the attached dumps ;).

Gcc's PPC code generator seems ok. Would be strange if we were the first to
notice a bug there. An important difference to 4.1 is that the 4.5 codegen
calls functions to save and restore the GPRs at function entry/exit. IIRC
this was defined for EABI?

And here we have a bug, in libkern's gprsaverest.S, in the case when we only
have to restore r31.

Here is a quick fix:
--- gprsavrest.S        2 Jul 2011 23:36:02 -0000       1.2
+++ gprsavrest.S        12 Aug 2011 11:54:59 -0000
@@ -64,8 +64,8 @@
        RESTGPR(28)
        RESTGPR(29)
        RESTGPR(30)
-       lwz     0,4(11)
        RESTGPR(31)
+       lwz     0,4(11)
        mtlr    0
        mr      1,11
        blr

It would be desirable when r0 is loaded a bit earlier, but that needs some
more modifications.

Now ofwboot and altboot work again for me!

-- 
Frank Wille



Home | Main Index | Thread Index | Old Index