This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: Cosure return value issue on Linux PPC64
- From: Andrew Haley <aph at redhat dot com>
- To: libffi-discuss at sourceware dot org
- Date: Mon, 29 May 2017 08:44:05 +0100
- Subject: Re: Cosure return value issue on Linux PPC64
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=aph at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 80A77C057FA7
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 80A77C057FA7
- References: <53985e874a349c551e7943677d21c766@mail.kylheku.com>
On 27/05/17 17:59, Kaz Kylheku (libffi) wrote:
>
> The problem is that all the big endian cases are expecting the caller to
> place the return value at a displaced address. If the type is int, for
> instance, the expectation is that the return value is to be stored at
> *(int *)(retval + 4). If it is short, then at *(short *)(retval + 6)
> and so on.
>
> Is this documented somewhere?
>
> My code is storing everything at just the retval base address,
> regardless of size.
On a 64-bit target, use word loads for your return values and cast them
accordingly. So, don't use
*(int *)(retval + 4)
use
(int)*retval
--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671