diff options
author | ktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-13 15:18:14 +0000 |
---|---|---|
committer | ktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-13 15:18:14 +0000 |
commit | 5f78be1e48f53b6cd5f6e60a79e4f3f07a2c00c8 (patch) | |
tree | 34ae0d61921efe6ef8675e314bd135d30145aefc /libffi | |
parent | dc35e8f6d2fadadd6c02462d3390885099367610 (diff) | |
download | gcc-5f78be1e48f53b6cd5f6e60a79e4f3f07a2c00c8.tar.gz |
PR libffi/52221
* src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
support for X86_WIN32.
(FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184155 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi')
-rw-r--r-- | libffi/ChangeLog | 7 | ||||
-rw-r--r-- | libffi/src/x86/ffi.c | 19 |
2 files changed, 23 insertions, 3 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog index c10a000e1bb..3b3167ae77b 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,10 @@ +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. + 2012-02-11 Eric Botcazou <ebotcazou@adacore.com> * src/sparc/v9.S (STACKFRAME): Bump to 176. diff --git a/libffi/src/x86/ffi.c b/libffi/src/x86/ffi.c index 7c01c57c4db..88edbc102f9 100644 --- a/libffi/src/x86/ffi.c +++ b/libffi/src/x86/ffi.c @@ -614,7 +614,7 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, { unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ 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 int *) &__tramp[0] = 0x8324048b; /* mov (%esp), %eax */ \ *(unsigned int *) &__tramp[4] = 0x4c890cec; /* sub $12, %esp */ \ @@ -720,6 +720,9 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* closure, int i; if (cif->abi != FFI_SYSV) { +#ifdef X86_WIN32 + if (cif->abi != FFI_THISCALL) +#endif return FFI_BAD_ABI; } @@ -734,10 +737,20 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* closure, 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, codeloc); - +#ifdef X86_WIN32 + } + else if (cif->abi == FFI_THISCALL) + { + FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_SYSV, + codeloc, cif->bytes); + } +#endif closure->cif = cif; closure->user_data = user_data; closure->fun = fun; |