Hi all, While I was looking at the dlmmap/dlmunmap code in closures.c, I started looking into testsuite FAILs to see if any of them might be caused by the code I had added, and stumbled across a bigger can of worms. The code in win32.S doesn't take account of numerous among the FFI_TYPE_xxx return types, leading to stack-based garbage being returned, and in one place mishandles the ABI convention that the callee should pop the hidden pointer arg for struct return types. Before this patch there were 66 FAILs on libffi HEAD (sourcware) and 20 on libffi GCC. After, there are only one or two remaining (depending on GCC version), both "test for excess errors" failures related to format-string warnings and unrelated to all this. Tested on i686-pc-cygwin; the GCC testing only involved bubblestrapping an existing $objdir rather than running a full bootstrap, but that should be OK for a target lib. libffi/ChangeLog: PR libffi/40807 * src/x86/ffi.c (ffi_prep_cif_machdep): Also use sign/zero-extending return types for X86_WIN32. * src/x86/win32.S (_ffi_call_SYSV): Handle omitted return types. (_ffi_call_STDCALL, _ffi_closure_SYSV, _ffi_closure_raw_SYSV, _ffi_closure_STDCALL): Likewise. * src/closures.c (is_selinux_enabled): Define to const 0 for Cygwin. (dlmmap, dlmunmap): Also use these functions on Cygwin. OK for both HEADs? And would you like me to apply the closures.c fix as a separate commit or shall I do them all together? cheers, DaveK