PCC ABI question

Joakim Tjernlund Joakim.Tjernlund at lumentis.se
Mon Mar 21 01:22:16 EST 2005

> Hi Folks
> It seems to me that linux doesn't follow the ABI for PowerPC.
> According to http://refspecs.freestandards.org/elf/elfspec_ppc.pdf,
> Figure 3-31(Initial Process Stack) should the stack ptr point to a NULL word, instead
> linux's stack ptr points to argc and there is no NULL word, correct?
> The initial register map, on p. 3-28, register r7 should point to a
> "termination function" or hold zero. Does linux do this?
> If so, where does it get the "termination function" from?
> If not, can one assume that r7 is NULL at all times?
> Are there other deviations from the above spec in linux?
>  Jocke 

[Moving this to linuxpcc-dev list]

Someone was kind enough to point me to this spec:
Which says:
"Contrary to what is stated in the Registers part of Chapter 3 of the System V Application Binary Interface PowerPC
Processor Supplement there are no values set in registers r3, r4, r5, r6 and r7. Instead the values specified to
appear in all of those registers except r7 are placed on the stack. The value to be placed into register r7,
the termination function pointer is not passed to the process."

It is not quite clear to me if r3, r4, r5, r6 and r7 contains random data or if one
can assume that some of them are set to NULL. It would be good if one could assume
that r7 is always set to NULL as that would simplify the startup code(crtX.S) in uClibc which
I am updating to support passing a FINI function ptr in r7.


More information about the Linuxppc-dev mailing list