This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: rs6000 struct returns
- To: Geoff Keating <geoffk at geoffk dot org>
- Subject: Re: rs6000 struct returns
- From: Michael Meissner <meissner at cygnus dot com>
- Date: Mon, 19 Mar 2001 21:26:54 -0500
- Cc: "James L. Dein" <jdein at windriver dot com>, gcc at gcc dot gnu dot org
- References: <200103200100.RAA01596@lackawaxen.wrs.com> <jm7l1li52k.fsf@geoffk.org>
On Mon, Mar 19, 2001 at 05:48:03PM -0800, Geoff Keating wrote:
> "James L. Dein" <jdein@windriver.com> writes:
>
> > According to the SVR4 ABI for rs6000, which is subsumed by the EABI, small
> > structs should be returned in r3/r4, if they fit. However, gcc is not doing
> > that: instead, all structs are being returned just like large structs, i.e., via
> > a secret pointer arg to an area allocated by the caller.
> >
> > Can anyone suggest how to implement the correct behavior? It appears that
> > returning structs in single regs is easy to implement, but there is no support
> > for returning in more than one reg.
>
> Have you tried -mcall-solaris? That should add this behaviour,
> although that's straight SVR4 not EABI.
>
> For EABI, this is probably a straight bug. Look at RETURN_IN_MEMORY
> in rs6000.c. The gotcha is that this can't immediately be changed for
> linux; it's on my to-do-when-next-breaking-abi list.
Yeah, its been a bug for 5 years ago, and as Geoff mentions, fixing it will
break linking objects compiled with previous compilers (particularly the dbm_*
functions under Linux). As I recall, structure returns is the one thing that
is different on Solaris than System V (of course PowerPC Solaris is long since
dead).
--
Michael Meissner, Red Hat, Inc. (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482