This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc and struct passing in function arguments?


> 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]