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

@@ -4,7 +4,7 @@
PR: none.
Originator: <twalljava@dev.java.net> */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"
static void
@@ -23,6 +23,9 @@ closure_test_stdcall(ffi_cif* cif __UNUSED__, void* resp, void** args,
}
#ifndef _MSC_VER
#define __stdcall __attribute__((stdcall))
#endif
typedef int (__stdcall *closure_test_type0)(int, int, int, int);
int main (void)

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: <ktietz@redhat.com> */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"
static void
@@ -23,6 +23,9 @@ closure_test_thiscall(ffi_cif* cif __UNUSED__, void* resp, void** args,
}
#ifndef _MSC_VER
#define __thiscall __attribute__((thiscall))
#endif
typedef int (__thiscall *closure_test_type0)(int, int, int, int);
int main (void)

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"
#include <float.h>

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"
#include <float.h>

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"
typedef struct

View File

@@ -4,7 +4,7 @@
PR: none.
Originator: From the original ffitest.c */
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
/* { dg-do run { target i?86-*-* } } */
#include "ffitest.h"
typedef struct