public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Russell Keith-Magee <russell@keith-magee.com>
To: Simon Frost <simon.frost@realvnc.com>
Cc: "libffi-discuss@sourceware.org" <libffi-discuss@sourceware.org>
Subject: Re: Crash when using closures on iOS+arm64
Date: Fri, 15 May 2015 01:08:00 -0000	[thread overview]
Message-ID: <CAJxq849kp_DODT8Vn0hAJFiKv0RxyjRu5BFhUGE8shreSYn=Jg@mail.gmail.com> (raw)
In-Reply-To: <82D490AB-0441-44F8-93D8-E22F7BEF3F89@realvnc.com>

Hi Simon,

On Fri, May 15, 2015 at 1:27 AM, Simon Frost <simon.frost@realvnc.com> wrote:
> Hi,
>
> I’ve been attempting to use closures across 32-bit, 64-bit and simulator builds of an iOS project but I consistently see a crash on the arm64 build when the closure is executed. This can be reproduced in a stripped down Xcode project by simply copying the code from the “closure_simple.c” unit test into the iOS application’s main.m file. I’ve seen this issue on both the latest code from master and the v3.2.1 tagged release.
>
> Specifically I see an EXC_BAD_ACCESS exception when trying to call the executable address pointer populated by ffi_closure_alloc. Somewhat interestingly I see that the executable address (out param) and the writeable address (return value) are set to the same value after calling ffi_closure_alloc on arm64, whereas they have different values on armv7. This may be a red herring though, as I also noticed they also have the same value when running in the i386 simulator where the code works correctly.
>
> All other libffi functionality appears to work fine on arm64, the only issue appears to be calling closures. Can anyone shed any light on this, or give me any pointers as to how this could be resolved? Unfortunately I’m not well enough versed in the lower levels of libffi to look into fixing this myself.

Yes, I've seen similar problems; master has *less* problems than the
tagged release from my testing, but there are still some edge cases
that don't work.

As for fixing it - I'm in the same boat as you. I can provide test
cases that demonstrate failures, but I have no idea how to fix those
problems. Unfortunately, it looks like there aren't many people around
who have an interest in iOS *and* know how the internals of libffi
work. The current master code doesn't even *compile* for ARMv7 [1][2],
but I haven't been able to shake out anyone who is able to address the
problem.

[1] https://github.com/atgreen/libffi/issues/181
[2] https://sourceware.org/ml/libffi-discuss/2015/msg00053.html

Yours,
Russ Magee %-)

      reply	other threads:[~2015-05-15  1:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 17:27 Simon Frost
2015-05-15  1:08 ` Russell Keith-Magee [this message]

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='CAJxq849kp_DODT8Vn0hAJFiKv0RxyjRu5BFhUGE8shreSYn=Jg@mail.gmail.com' \
    --to=russell@keith-magee.com \
    --cc=libffi-discuss@sourceware.org \
    --cc=simon.frost@realvnc.com \
    /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).