[klibc] [PATCH] update crt0.S on ppc32

H. Peter Anvin hpa at zytor.com
Mon Dec 8 11:47:57 PST 2003


Olaf Hering wrote:
> 
> 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.
> 
> I'm not a native speaker, but it sounds like the 'fini' function is
> unused? 
> 

Oh, ok.  That would have been unparsable without having read the psABI
first :)

Basically what it's saying is that the ppc psABI is different from every
other psABI, and we don't want to deal with the differences.  All the
other psABIs pass the same format of the initial process stack (that's
why klibc nowadays has __libc_init to parse it instead of doing it
architecture-specific assembly.)  Linux/ppc does it like all the other
architectures rather than introducing a probably better but still
different ABI.

Thus, the only two architecture-specific parameters is "where is the ELF
 stack info block image" (usually pointed to by the stack pointer, but
not necessarily -- especially not on grow-up architectures) and "what is
the onexit pointer".  Additionally, it's usually required to terminate
the stack frame chain for debugging to work right.

The Linux kernel doesn't currently use the onexit pointer, however, I'd
rather have support for it in the crt0.S files so that if we ever find
we need it we can just fix the common __libc_init code.

Obviously, if the original psABI authors had spent a few minutes
thinking a bit further about this, they would have made the process
entry conditions compatible with the particular architecture C calling
convention, since that is defined in the same document.  However, they
didn't, so we need a stub -- crt0.S -- to do that job for them.

	-hpa



More information about the klibc mailing list