IainS, Your patch completely broke libffi on AIX and your changes were not Darwin-specific, despite Mike Stump's comment with his approval.
AIX shares ffi_darwin.c, as one should be able to see from all of the AIX comments in the file. aix_closure.S expects ffi_closure_helper_DARWIN to return the type, as it previously did. So the following change completely breaks FFI on AIX: /* Tell ffi_closure_ASM to perform return type promotions. */ - return cif->rtype->type; + return cif->rtype; - David