This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: [SPARC v8] Make ffi compatible with Solaris Studio aggregate return ABI
- From: Anthony Green <green at redhat dot com>
- To: Ginn Chen <ginn dot chen at oracle dot com>
- Cc: libffi-discuss at sourceware dot org
- Date: Tue, 08 Feb 2011 10:45:31 -0500
- Subject: Re: [SPARC v8] Make ffi compatible with Solaris Studio aggregate return ABI
- References: <DFE51D43-627B-402B-A9C3-C8BD6067744A@oracle.com>
Ginn Chen <ginn.chen@oracle.com> writes:
> SPARC V8 Manual has:
> "When a procedure expecting an aggregate return value from a called function is
> compiled, an UNIMP instruction is placed after the delay-slot instruction
> following the CALL to the function in question. The immediate field in this
> UNIMP instruction contains the low-order twelve bits of the size (in bytes) of
> the area allocated by the caller for the aggregate value expected to be
> returned."
>
> The function compiled by gcc doesn't check the UNIMP instruction, it simply copy the returning struct and jump to %i7+12.
> The same function compiled by Solaris Studio, checks the struct size in UNIMP instruction, if it matches the returning struct it will copy the value and jump to %i7+12,
> if not it will do nothing and jump to %i7+8.
>
> So simply adding a nop in v8.S doesn't work with libraries compiled by Solaris Studio.
> e.g. if I compile testsuite/cls_8byte.c with Solaris Studio, it will not pass the test.
>
> I have a patch to alloc some executable space and make the call with exact struct size there.
> The patch is at:
> https://bugzilla.mozilla.org/show_bug.cgi?id=583206
>
> I have tested it on Solaris with both gcc and Solaris Studio.
>
> Please review it.
Thanks Ginn. This looks good to me. I've committed it to libffi.
AG
>
> Thanks,
>
> Ginn