iOS: Fix the longjmp/setjmp ffi (#613)

* iOS: Fix the `longjmp`/`setjmp` ffi. `jmp_buf` was the wrong size (too small) causing crashes on application launch, make longjmp return Never

* remove extra parentheses around JBLEN, and add a changelog entry about the JmpBuf fix
This commit is contained in:
mtak- 2018-07-26 16:27:26 -07:00 committed by Francesca Frangipane
parent 88427262a6
commit 4c117aa282
3 changed files with 16 additions and 4 deletions

View file

@ -64,10 +64,20 @@ extern {
extern {
pub fn setjmp(env: *mut c_void) -> c_int;
pub fn longjmp(env: *mut c_void, val: c_int);
pub fn longjmp(env: *mut c_void, val: c_int) -> !;
}
pub type JmpBuf = [c_int; 27];
// values taken from "setjmp.h" header in xcode iPhoneOS/iPhoneSimulator SDK
#[cfg(any(target_arch = "x86_64"))]
pub const JBLEN: usize = (9 * 2) + 3 + 16;
#[cfg(any(target_arch = "x86"))]
pub const JBLEN: usize = 18;
#[cfg(target_arch = "arm")]
pub const JBLEN: usize = 10 + 16 + 2;
#[cfg(target_arch = "aarch64")]
pub const JBLEN: usize = (14 + 8 + 2) * 2;
pub type JmpBuf = [c_int; JBLEN];
pub trait NSString: Sized {
unsafe fn alloc(_: Self) -> id {