Add support for stdcall, thiscall, and fastcall on non-Windows x86-32

Linux supports the stdcall calling convention, either via functions
explicitly declared with the stdcall attribute, or via code compiled
with -mrtd which effectively makes stdcall the default.

This introduces FFI_STDCALL, FFI_THISCALL, and FFI_FASTCALL on
non-Windows x86-32 platforms, as non-default calling conventions.
This commit is contained in:
Josh Triplett
2014-03-16 03:25:53 -07:00
parent 9531d05f64
commit e1911f78df
16 changed files with 126 additions and 75 deletions

View File

@@ -1,3 +1,37 @@
2014-03-16 Josh Triplett <josh@joshtriplett.org>
Add support for stdcall, thiscall, and fastcall on non-Windows x86-32.
Linux supports the stdcall calling convention, either via functions
explicitly declared with the stdcall attribute, or via code compiled
with -mrtd which effectively makes stdcall the default.
This introduces FFI_STDCALL, FFI_THISCALL, and FFI_FASTCALL on
non-Windows x86-32 platforms, as non-default calling conventions.
* Makefile.am: Compile in src/x86/win32.S on non-Windows x86-32.
* src/x86/ffitarget.h: Add FFI_STDCALL, FFI_THISCALL, and FFI_FASTCALL
on non-Windows x86-32. Increase trampoline size to accomodate these
calling conventions, and unify some ifdeffery.
* src/x86/ffi.c: Add support for FFI_STDCALL, FFI_THISCALL, and
FFI_FASTCALL on non-Windows x86-32 platforms; update ifdeffery.
* src/x86/win32.S: Support compiling on non-Windows x86-32 platforms.
On those platforms, avoid redefining the SYSV symbols already provided
by src/x86/sysv.S.
* testsuite/libffi.call/closure_stdcall.c: Run on non-Windows.
#define __stdcall if needed.
* testsuite/libffi.call/closure_thiscall.c: Run on non-Windows.
#define __fastcall if needed.
* testsuite/libffi.call/fastthis1_win32.c: Run on non-Windows.
* testsuite/libffi.call/fastthis2_win32.c: Ditto.
* testsuite/libffi.call/fastthis3_win32.c: Ditto.
* testsuite/libffi.call/many2_win32.c: Ditto.
* testsuite/libffi.call/many_win32.c: Ditto.
* testsuite/libffi.call/strlen2_win32.c: Ditto.
* testsuite/libffi.call/strlen_win32.c: Ditto.
* testsuite/libffi.call/struct1_win32.c: Ditto.
* testsuite/libffi.call/struct2_win32.c: Ditto.
2014-03-16 Josh Triplett <josh@joshtriplett.org>
* prep_cif.c: Remove unnecessary ifdef for X86_WIN32.