fb_build in _cffi_backend.c hardcodes alignment to 8
ppc64le's long double is aligned to 16 bytes, making generic engine verifier tests fail on the platform with:
=================================== FAILURES ===================================
__________________________ test_longdouble_precision ___________________________
...
> assert abs(more_precise - less_precise) > 0.1
E assert 0.0 > 0.1
E + where 0.0 = abs((0.0 - 0.0))
testing/cffi0/test_verify.py:199: AssertionError
(On the machine i have access to, using 8-byte aligned long double* happens to give wrong results rather than crash outright.)
According to libffi docs, return types smaller than the system register (ffi_arg) are promoted to that size. But larger types aren't. The docs don't say how this affects alignment, put presumably the return type should be aligned to both type->alignment and ffi_arg alignment?
Arguments aren't kept aligned either. In libffi docs, I couldn't find an explicit mention of whether this is OK, but I assume it isn't.
I'm attaching a PoC patch for these issues.
The buffer in _cffi_backend's cdata_call also isn't explicitly aligned. Here I'm not sure what the best solution for python-cffi would be.