Port-powerpc archive

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

Re: executable formats in port-powerpc

>   Just a note of warning about using the GNU tools for
> cross-development:  I've found a bug in the powerpc-*-elf
> gcc- code, where varargs functions don't set the argument pointer
> properly.  I have no idea about the fix -- for now I use the
> workaround of figuring out what the correction needs to be (by
> looking at assembly output) and adding an "ap -= xxx;" line into
> the top of the varargs function, and then recompiling.  If
> anyone else has gotten varargs powerpc-*-elf stuff to compile
> properly (any version of gcc), I'd appreciate you telling me how.

Hmm, there is a bug in varargs handling in the way gcc inplements svr4 abi
for powerpc.  It however AFAIK only concerns handling of aggregate types.
The actual bug is IMHO in the machine independent part of gcc, but since the
relevant builtin function (__builtin_classify_type) isn't (probably) used in
other implementations (at least not in the way it is used in the powerpc
implementation), it hasn't (or has it?) shown up yet.

To get this working, I changed the include file <machine/va-ppc.h> a bit
to compensate for this bug.  This change however makes the varargs
implementation non-compliant to the svr4 abi, but I'm not sure whether this
is relevant enough to make it a high priority item.

>   For that matter, if anyone knows of a publicly-available gcc
> AND binutils powerpc-*-* target (either endianness, any
> executable format:  COFF, XCOFF, ELF, AOUT, other) that works
> for cross-compiling AND cross-linking, please let me know!  I've
> tried powerpc-ibm-aix (GNU ld can't cross-link some
> gcc-generated assembly) and powerpc-*-elf (and powerpc-*-eabi),
> which has the above varargs bug (and maybe others???).

Regarding varargs you might want to try to substitute the va-ppc.h file
from sys/arch/powerpc/include for the one in the gcc distribution.

Regarding cross-development gcc, there is a patch in
ftp://ftp.netbsd.org/pub/NetBSD/arch/powerpc/gcc to gcc to make it
cross-compile for NetBSD/powerpc, i.e. big endian a.out format.

OK, this patch is far from satisfactory.  For one it's reverse :-(, and then
the resulting gcc tree doesn't even compile on NetBSD/powerpc due to some
conflicts between gcc macros and NetBSD defines.  I'm currently working on
fixing this.  I'll also look into setting up working binutils for
ws%TooLs.DE@localhost     (Wolfgang Solfrank, TooLs GmbH)       +49-228-985800

Home | Main Index | Thread Index | Old Index