From: Andrew Haley <aph@redhat.com>
To: libffi-discuss@sourceware.org
Subject: Re: Cosure return value issue on Linux PPC64
Date: Mon, 29 May 2017 07:44:00 -0000 [thread overview]
Message-ID: <e4f84547-de49-6068-0778-c92dce969ae6@redhat.com> (raw)
In-Reply-To: <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
next prev parent reply other threads:[~2017-05-29 7:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-27 16:59 Kaz Kylheku (libffi)
2017-05-29 7:44 ` Andrew Haley [this message]
2017-05-29 12:31 ` Tom Tromey
2017-05-29 15:30 ` Andrew Haley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e4f84547-de49-6068-0778-c92dce969ae6@redhat.com \
--to=aph@redhat.com \
--cc=libffi-discuss@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).