gcc and struct passing in function arguments?

Joern Rennecke amylaar@cygnus.co.uk
Wed Jul 5 14:00:00 GMT 2000


> It depends on the ABI.  Different ABI's do different things.  For example,
> powerpc-eabi or powerpc-linux always passes structures by copying the structure
> to a temporary location on the stack and passing the address of the temporary.

i386-linux has several ABIs.  linux-elf uses the SYSV ABI and therefore
returns structures and unions in memory. linux-aout returns them in
registers if the mode is suitable (i.e. SImode or DImode).

You can use -freg-struct-return with linux-elf, but it causes problems
if you link with any library function that returns a struct, or call one
that gets passed a pointer to a function that returns a struct.


More information about the Gcc mailing list