This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/6] MSVC fixes


Hi!

This series fixes a number of problems that MSVC has with libffi.

The first patches are pretty mechanic, but the last one adds a
new ABI for x86-win32.  As it happens, Microsoft and GCC does not
agree on the details of the cdecl calling convention when they
are returning structures (at least).  MS thinks that the caller
pops the hidden structure return address and GCC thinks that
the callee should do it.  And MS relies on the callee to return
the structure return address in eax, while GCC seems to not care
about that (which is pretty sane, the compiler should be able
to keep track och where it did put that structure after all).

With the patches the testsuite behaves *much* better for MSVC.
What still fails is return_uc.c (crashes, but works when running
in the debugger), struct1_win32.c, struct2_win32.c (haven't
really looked, they crash) and closure_thiscall.c (no support for
using __thiscall from C apparently). And both the C++ tests fail
(haven't looked at all).

It would be interesting to see if MSVC can call into a libffi
built by GCC and vice versa, to check if the structure return
discrepancy really is fixed.  That should be possible if I did
this right, right?

Cheers,
Peter

[PATCH 1/6] Put declarations before statements, C89 style
[PATCH 2/6] Add kludge for missing format specifiers on MSVC
[PATCH 3/6] Remove surplus frame from MASM function entry
[PATCH 4/6] Use __fastcall for MSVC
[PATCH 5/6] Translate inline assembly to MSVC format
[PATCH 6/6] Add Microsoftian variant of the cdecl ABI


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]