Rebase on fixed GCC sources

This commit is contained in:
Anthony Green
2012-03-29 08:48:22 -04:00
parent e72ed5eeaa
commit 7c5e60b5f4
13 changed files with 2318 additions and 22 deletions

View File

@@ -32,11 +32,28 @@
windows-like hosts. windows-like hosts.
* configure: Rebuilt. * configure: Rebuilt.
2012-02-27 Mikael Pettersson <mikpe@it.uu.se>
PR libffi/52223
* Makefile.am (FLAGS_TO_PASS): Define.
* Makefile.in: Regenerate.
2012-02-23 Anthony Green <green@moxielogic.com> 2012-02-23 Anthony Green <green@moxielogic.com>
* src/*/ffitarget.h: Ensure that users never include ffitarget.h * src/*/ffitarget.h: Ensure that users never include ffitarget.h
directly. directly.
2012-02-23 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_closure_raw_THISCALL): New
prototype.
(ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
thiscall-convention.
(ffi_raw_call): Use ffi_prep_args_raw.
* src/x86/win32.S (ffi_closure_raw_THISCALL): Add
implementation for stub.
2012-02-10 Kai Tietz <ktietz@redhat.com> 2012-02-10 Kai Tietz <ktietz@redhat.com>
* configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64 * configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64
@@ -262,6 +279,10 @@
* src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
just return FFI_BAD_ABI when things are wrong. just return FFI_BAD_ABI when things are wrong.
2012-02-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/v9.S (STACKFRAME): Bump to 176.
2011-02-09 Stuart Shelton <srcshelton@gmail.com> 2011-02-09 Stuart Shelton <srcshelton@gmail.com>
http://bugs.gentoo.org/show_bug.cgi?id=286911 http://bugs.gentoo.org/show_bug.cgi?id=286911
@@ -790,6 +811,13 @@
* src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE
type on HP-UX. type on HP-UX.
2012-02-13 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
support for X86_WIN32.
(FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.
2009-12-11 Eric Botcazou <ebotcazou@adacore.com> 2009-12-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long

View File

@@ -37,11 +37,28 @@
windows-like hosts. windows-like hosts.
* configure: Rebuilt. * configure: Rebuilt.
2012-02-27 Mikael Pettersson <mikpe@it.uu.se>
PR libffi/52223
* Makefile.am (FLAGS_TO_PASS): Define.
* Makefile.in: Regenerate.
2012-02-23 Anthony Green <green@moxielogic.com> 2012-02-23 Anthony Green <green@moxielogic.com>
* src/*/ffitarget.h: Ensure that users never include ffitarget.h * src/*/ffitarget.h: Ensure that users never include ffitarget.h
directly. directly.
2012-02-23 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_closure_raw_THISCALL): New
prototype.
(ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
thiscall-convention.
(ffi_raw_call): Use ffi_prep_args_raw.
* src/x86/win32.S (ffi_closure_raw_THISCALL): Add
implementation for stub.
2012-02-10 Kai Tietz <ktietz@redhat.com> 2012-02-10 Kai Tietz <ktietz@redhat.com>
* configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64 * configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64
@@ -267,6 +284,10 @@
* src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
just return FFI_BAD_ABI when things are wrong. just return FFI_BAD_ABI when things are wrong.
2012-02-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/v9.S (STACKFRAME): Bump to 176.
2011-02-09 Stuart Shelton <srcshelton@gmail.com> 2011-02-09 Stuart Shelton <srcshelton@gmail.com>
http://bugs.gentoo.org/show_bug.cgi?id=286911 http://bugs.gentoo.org/show_bug.cgi?id=286911
@@ -795,6 +816,13 @@
* src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE
type on HP-UX. type on HP-UX.
2012-02-13 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
support for X86_WIN32.
(FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.
2009-12-11 Eric Botcazou <ebotcazou@adacore.com> 2009-12-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long

1038
.pc/stand-alone/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -55,11 +55,28 @@
windows-like hosts. windows-like hosts.
* configure: Rebuilt. * configure: Rebuilt.
2012-02-27 Mikael Pettersson <mikpe@it.uu.se>
PR libffi/52223
* Makefile.am (FLAGS_TO_PASS): Define.
* Makefile.in: Regenerate.
2012-02-23 Anthony Green <green@moxielogic.com> 2012-02-23 Anthony Green <green@moxielogic.com>
* src/*/ffitarget.h: Ensure that users never include ffitarget.h * src/*/ffitarget.h: Ensure that users never include ffitarget.h
directly. directly.
2012-02-23 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_closure_raw_THISCALL): New
prototype.
(ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
thiscall-convention.
(ffi_raw_call): Use ffi_prep_args_raw.
* src/x86/win32.S (ffi_closure_raw_THISCALL): Add
implementation for stub.
2012-02-10 Kai Tietz <ktietz@redhat.com> 2012-02-10 Kai Tietz <ktietz@redhat.com>
* configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64 * configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64
@@ -285,6 +302,10 @@
* src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
just return FFI_BAD_ABI when things are wrong. just return FFI_BAD_ABI when things are wrong.
2012-02-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/v9.S (STACKFRAME): Bump to 176.
2011-02-09 Stuart Shelton <srcshelton@gmail.com> 2011-02-09 Stuart Shelton <srcshelton@gmail.com>
http://bugs.gentoo.org/show_bug.cgi?id=286911 http://bugs.gentoo.org/show_bug.cgi?id=286911
@@ -813,6 +834,13 @@
* src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE
type on HP-UX. type on HP-UX.
2012-02-13 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
support for X86_WIN32.
(FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.
2009-12-11 Eric Botcazou <ebotcazou@adacore.com> 2009-12-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long

View File

@@ -42,11 +42,28 @@
windows-like hosts. windows-like hosts.
* configure: Rebuilt. * configure: Rebuilt.
2012-02-27 Mikael Pettersson <mikpe@it.uu.se>
PR libffi/52223
* Makefile.am (FLAGS_TO_PASS): Define.
* Makefile.in: Regenerate.
2012-02-23 Anthony Green <green@moxielogic.com> 2012-02-23 Anthony Green <green@moxielogic.com>
* src/*/ffitarget.h: Ensure that users never include ffitarget.h * src/*/ffitarget.h: Ensure that users never include ffitarget.h
directly. directly.
2012-02-23 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_closure_raw_THISCALL): New
prototype.
(ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
thiscall-convention.
(ffi_raw_call): Use ffi_prep_args_raw.
* src/x86/win32.S (ffi_closure_raw_THISCALL): Add
implementation for stub.
2012-02-10 Kai Tietz <ktietz@redhat.com> 2012-02-10 Kai Tietz <ktietz@redhat.com>
* configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64 * configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64
@@ -272,6 +289,10 @@
* src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
just return FFI_BAD_ABI when things are wrong. just return FFI_BAD_ABI when things are wrong.
2012-02-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/v9.S (STACKFRAME): Bump to 176.
2011-02-09 Stuart Shelton <srcshelton@gmail.com> 2011-02-09 Stuart Shelton <srcshelton@gmail.com>
http://bugs.gentoo.org/show_bug.cgi?id=286911 http://bugs.gentoo.org/show_bug.cgi?id=286911
@@ -800,6 +821,13 @@
* src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE
type on HP-UX. type on HP-UX.
2012-02-13 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
support for X86_WIN32.
(FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.
2009-12-11 Eric Botcazou <ebotcazou@adacore.com> 2009-12-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long

View File

@@ -264,6 +264,18 @@ ffi_closure_SYSV ENDP
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
#define CIF_FLAGS_OFFSET 20 #define CIF_FLAGS_OFFSET 20
ffi_closure_raw_THISCALL PROC NEAR
push ebp
mov ebp, esp
push esi
sub esp, 36
mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif
mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
mov [esp + 12], edx
lea edx, [ebp + 12], edx
jmp stubraw
ffi_closure_raw_SYSV ENDP
ffi_closure_raw_SYSV PROC NEAR USES esi ffi_closure_raw_SYSV PROC NEAR USES esi
;; the ffi_closure ctx is passed in eax by the trampoline. ;; the ffi_closure ctx is passed in eax by the trampoline.
@@ -272,6 +284,7 @@ ffi_closure_raw_SYSV PROC NEAR USES esi
mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
mov [esp + 12], edx ;; user_data mov [esp + 12], edx ;; user_data
lea edx, [ebp + 8] lea edx, [ebp + 8]
stubraw:
mov [esp + 8], edx ;; raw_args mov [esp + 8], edx ;; raw_args
lea edx, [ebp - 24] lea edx, [ebp - 24]
mov [esp + 4], edx ;; &res mov [esp + 4], edx ;; &res
@@ -722,7 +735,21 @@ _ffi_closure_SYSV:
#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
#define CIF_FLAGS_OFFSET 20 #define CIF_FLAGS_OFFSET 20
.balign 16
.globl _ffi_closure_raw_THISCALL
#ifndef __OS2__
.def _ffi_closure_raw_THISCALL; .scl 2; .type 32; .endef
#endif
_ffi_closure_raw_THISCALL:
pushl %ebp
movl %esp, %ebp
pushl %esi
subl $36, %esp
movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */
movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
movl %edx, 12(%esp) /* user_data */
leal 12(%ebp), %edx /* __builtin_dwarf_cfa () */
jmp .stubraw
# This assumes we are using gas. # This assumes we are using gas.
.balign 16 .balign 16
.globl _ffi_closure_raw_SYSV .globl _ffi_closure_raw_SYSV
@@ -742,6 +769,7 @@ _ffi_closure_raw_SYSV:
movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
movl %edx, 12(%esp) /* user_data */ movl %edx, 12(%esp) /* user_data */
leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */
.stubraw:
movl %edx, 8(%esp) /* raw_args */ movl %edx, 8(%esp) /* raw_args */
leal -24(%ebp), %edx leal -24(%ebp), %edx
movl %edx, 4(%esp) /* &res */ movl %edx, 4(%esp) /* &res */

View File

@@ -48,11 +48,28 @@
windows-like hosts. windows-like hosts.
* configure: Rebuilt. * configure: Rebuilt.
2012-02-27 Mikael Pettersson <mikpe@it.uu.se>
PR libffi/52223
* Makefile.am (FLAGS_TO_PASS): Define.
* Makefile.in: Regenerate.
2012-02-23 Anthony Green <green@moxielogic.com> 2012-02-23 Anthony Green <green@moxielogic.com>
* src/*/ffitarget.h: Ensure that users never include ffitarget.h * src/*/ffitarget.h: Ensure that users never include ffitarget.h
directly. directly.
2012-02-23 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_closure_raw_THISCALL): New
prototype.
(ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
thiscall-convention.
(ffi_raw_call): Use ffi_prep_args_raw.
* src/x86/win32.S (ffi_closure_raw_THISCALL): Add
implementation for stub.
2012-02-10 Kai Tietz <ktietz@redhat.com> 2012-02-10 Kai Tietz <ktietz@redhat.com>
* configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64 * configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64
@@ -278,6 +295,10 @@
* src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
just return FFI_BAD_ABI when things are wrong. just return FFI_BAD_ABI when things are wrong.
2012-02-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/v9.S (STACKFRAME): Bump to 176.
2011-02-09 Stuart Shelton <srcshelton@gmail.com> 2011-02-09 Stuart Shelton <srcshelton@gmail.com>
http://bugs.gentoo.org/show_bug.cgi?id=286911 http://bugs.gentoo.org/show_bug.cgi?id=286911
@@ -806,6 +827,13 @@
* src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE
type on HP-UX. type on HP-UX.
2012-02-13 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
support for X86_WIN32.
(FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.
2009-12-11 Eric Botcazou <ebotcazou@adacore.com> 2009-12-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long

View File

@@ -61,11 +61,28 @@
windows-like hosts. windows-like hosts.
* configure: Rebuilt. * configure: Rebuilt.
2012-02-27 Mikael Pettersson <mikpe@it.uu.se>
PR libffi/52223
* Makefile.am (FLAGS_TO_PASS): Define.
* Makefile.in: Regenerate.
2012-02-23 Anthony Green <green@moxielogic.com> 2012-02-23 Anthony Green <green@moxielogic.com>
* src/*/ffitarget.h: Ensure that users never include ffitarget.h * src/*/ffitarget.h: Ensure that users never include ffitarget.h
directly. directly.
2012-02-23 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_closure_raw_THISCALL): New
prototype.
(ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
thiscall-convention.
(ffi_raw_call): Use ffi_prep_args_raw.
* src/x86/win32.S (ffi_closure_raw_THISCALL): Add
implementation for stub.
2012-02-10 Kai Tietz <ktietz@redhat.com> 2012-02-10 Kai Tietz <ktietz@redhat.com>
* configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64 * configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64
@@ -291,6 +308,10 @@
* src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
just return FFI_BAD_ABI when things are wrong. just return FFI_BAD_ABI when things are wrong.
2012-02-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/v9.S (STACKFRAME): Bump to 176.
2011-02-09 Stuart Shelton <srcshelton@gmail.com> 2011-02-09 Stuart Shelton <srcshelton@gmail.com>
http://bugs.gentoo.org/show_bug.cgi?id=286911 http://bugs.gentoo.org/show_bug.cgi?id=286911
@@ -819,6 +840,13 @@
* src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE
type on HP-UX. type on HP-UX.
2012-02-13 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
* src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
support for X86_WIN32.
(FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.
2009-12-11 Eric Botcazou <ebotcazou@adacore.com> 2009-12-11 Eric Botcazou <ebotcazou@adacore.com>
* src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long

6
configure vendored
View File

@@ -14245,10 +14245,10 @@ if ${libffi_cv_as_x86_pcrel+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
libffi_cv_as_x86_pcrel=no libffi_cv_as_x86_pcrel=yes
echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
if $CC $CFLAGS -c conftest.s > /dev/null; then if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then
libffi_cv_as_x86_pcrel=yes libffi_cv_as_x86_pcrel=no
fi fi
fi fi

File diff suppressed because it is too large Load Diff

View File

@@ -32,7 +32,7 @@
/* Only compile this in for 64bit builds, because otherwise the object file /* Only compile this in for 64bit builds, because otherwise the object file
will have inproper architecture due to used instructions. */ will have inproper architecture due to used instructions. */
#define STACKFRAME 128 /* Minimum stack framesize for SPARC */ #define STACKFRAME 176 /* Minimum stack framesize for SPARC 64-bit */
#define STACK_BIAS 2047 #define STACK_BIAS 2047
#define ARGS (128) /* Offset of register area in frame */ #define ARGS (128) /* Offset of register area in frame */

View File

@@ -426,6 +426,8 @@ unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *)
void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *)
__attribute__ ((regparm(1))); __attribute__ ((regparm(1)));
#ifdef X86_WIN32 #ifdef X86_WIN32
void FFI_HIDDEN ffi_closure_raw_THISCALL (ffi_raw_closure *)
__attribute__ ((regparm(1)));
void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *)
__attribute__ ((regparm(1))); __attribute__ ((regparm(1)));
void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *) void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *)
@@ -593,7 +595,7 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue,
{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \
unsigned int __fun = (unsigned int)(FUN); \ unsigned int __fun = (unsigned int)(FUN); \
unsigned int __ctx = (unsigned int)(CTX); \ unsigned int __ctx = (unsigned int)(CTX); \
unsigned int __dis = __fun - (__ctx + 22); \ unsigned int __dis = __fun - (__ctx + 49); \
unsigned short __size = (unsigned short)(SIZE); \ unsigned short __size = (unsigned short)(SIZE); \
*(unsigned int *) &__tramp[0] = 0x8324048b; /* mov (%esp), %eax */ \ *(unsigned int *) &__tramp[0] = 0x8324048b; /* mov (%esp), %eax */ \
*(unsigned int *) &__tramp[4] = 0x4c890cec; /* sub $12, %esp */ \ *(unsigned int *) &__tramp[4] = 0x4c890cec; /* sub $12, %esp */ \
@@ -699,6 +701,9 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
int i; int i;
if (cif->abi != FFI_SYSV) { if (cif->abi != FFI_SYSV) {
#ifdef X86_WIN32
if (cif->abi != FFI_THISCALL)
#endif
return FFI_BAD_ABI; return FFI_BAD_ABI;
} }
@@ -713,10 +718,20 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE);
} }
#ifdef X86_WIN32
if (cif->abi == FFI_SYSV)
{
#endif
FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV,
codeloc); codeloc);
#ifdef X86_WIN32
}
else if (cif->abi == FFI_THISCALL)
{
FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL,
codeloc, cif->bytes);
}
#endif
closure->cif = cif; closure->cif = cif;
closure->user_data = user_data; closure->user_data = user_data;
closure->fun = fun; closure->fun = fun;
@@ -761,7 +776,7 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
#ifdef X86_WIN32 #ifdef X86_WIN32
case FFI_SYSV: case FFI_SYSV:
case FFI_STDCALL: case FFI_STDCALL:
ffi_call_win32(ffi_prep_args, &ecif, cif->abi, cif->bytes, cif->flags, ffi_call_win32(ffi_prep_args_raw, &ecif, cif->abi, cif->bytes, cif->flags,
ecif.rvalue, fn); ecif.rvalue, fn);
break; break;
case FFI_THISCALL: case FFI_THISCALL:
@@ -789,7 +804,7 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
cif->abi = abi = FFI_THISCALL; cif->abi = abi = FFI_THISCALL;
if (passed_regs < 1 && abi == FFI_THISCALL) if (passed_regs < 1 && abi == FFI_THISCALL)
cif->abi = abi = FFI_STDCALL; cif->abi = abi = FFI_STDCALL;
ffi_call_win32(ffi_prep_args, &ecif, abi, cif->bytes, cif->flags, ffi_call_win32(ffi_prep_args_raw, &ecif, abi, cif->bytes, cif->flags,
ecif.rvalue, fn); ecif.rvalue, fn);
} }
break; break;

View File

@@ -264,6 +264,18 @@ ffi_closure_SYSV ENDP
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
#define CIF_FLAGS_OFFSET 20 #define CIF_FLAGS_OFFSET 20
ffi_closure_raw_THISCALL PROC NEAR
push ebp
mov ebp, esp
push esi
sub esp, 36
mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif
mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
mov [esp + 12], edx
lea edx, [ebp + 12], edx
jmp stubraw
ffi_closure_raw_SYSV ENDP
ffi_closure_raw_SYSV PROC NEAR USES esi ffi_closure_raw_SYSV PROC NEAR USES esi
;; the ffi_closure ctx is passed in eax by the trampoline. ;; the ffi_closure ctx is passed in eax by the trampoline.
@@ -272,6 +284,7 @@ ffi_closure_raw_SYSV PROC NEAR USES esi
mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
mov [esp + 12], edx ;; user_data mov [esp + 12], edx ;; user_data
lea edx, [ebp + 8] lea edx, [ebp + 8]
stubraw:
mov [esp + 8], edx ;; raw_args mov [esp + 8], edx ;; raw_args
lea edx, [ebp - 24] lea edx, [ebp - 24]
mov [esp + 4], edx ;; &res mov [esp + 4], edx ;; &res
@@ -722,7 +735,21 @@ _ffi_closure_SYSV:
#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
#define CIF_FLAGS_OFFSET 20 #define CIF_FLAGS_OFFSET 20
.balign 16
.globl _ffi_closure_raw_THISCALL
#ifndef __OS2__
.def _ffi_closure_raw_THISCALL; .scl 2; .type 32; .endef
#endif
_ffi_closure_raw_THISCALL:
pushl %ebp
movl %esp, %ebp
pushl %esi
subl $36, %esp
movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */
movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
movl %edx, 12(%esp) /* user_data */
leal 12(%ebp), %edx /* __builtin_dwarf_cfa () */
jmp .stubraw
# This assumes we are using gas. # This assumes we are using gas.
.balign 16 .balign 16
.globl _ffi_closure_raw_SYSV .globl _ffi_closure_raw_SYSV
@@ -742,6 +769,7 @@ _ffi_closure_raw_SYSV:
movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
movl %edx, 12(%esp) /* user_data */ movl %edx, 12(%esp) /* user_data */
leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */
.stubraw:
movl %edx, 8(%esp) /* raw_args */ movl %edx, 8(%esp) /* raw_args */
leal -24(%ebp), %edx leal -24(%ebp), %edx
movl %edx, 4(%esp) /* &res */ movl %edx, 4(%esp) /* &res */