Description
When using ucontext_t
in getcontext
(manually added, the API seems not to be exported on aarch64 mac in libc), like so:
extern "C" {
fn getcontext(ucp: *mut ucontext_t) -> c_int;
}
the compiler complains that ucontext_t is not ffi-safe, as 128 bit integers are not supported in FFI.
I did not find any use of 128 bit ints, hence, I assume the compiler is overly smart for the neon state(?) which is:
#[repr(align(16))]
pub struct __darwin_arm_neon_state64 {
pub __v: [[u64; 2]; 32],
pub __fpsr: u32,
pub __fpcr: u32,
}
When I hand-roll the ucontext_t struct, including a neon-state like this, the compiler no longer complains.
#[repr(C, align(16))]
pub struct arm_neon_state64 {
pub opaque: [u8; (32 * 16) + (2 * mem::size_of::<u32>())],
}
Coincidentally, my testcase would segfault after the original getcontext, which may be related.
This is on macos, aarch64, with libc 0.2.121 and rust 1.59.0