diff options
author | Anthony Green <green@moxielogic.com> | 2022-09-15 15:18:09 -0400 |
---|---|---|
committer | Anthony Green <green@moxielogic.com> | 2022-09-15 15:18:09 -0400 |
commit | 05785cafcf584d80c6b48651e1d33c4a3feca75c (patch) | |
tree | eff2bf4993d5c3cfa308692fe6cebe3969fd2bca /src/x86/ffi.c | |
parent | 98d4ad65e9933ed4878ef4aacfaa8299e467a903 (diff) | |
download | libffi-05785cafcf584d80c6b48651e1d33c4a3feca75c.tar.gz |
Fix arg alignment for STDCALL
Diffstat (limited to 'src/x86/ffi.c')
-rw-r--r-- | src/x86/ffi.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/x86/ffi.c b/src/x86/ffi.c index 24431c1..3da6716 100644 --- a/src/x86/ffi.c +++ b/src/x86/ffi.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2017 Anthony Green + ffi.c - Copyright (c) 2017, 2022 Anthony Green Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. Copyright (c) 2002 Ranjit Mathew Copyright (c) 2002 Bo Thorsen @@ -182,7 +182,12 @@ ffi_prep_cif_machdep(ffi_cif *cif) { ffi_type *t = cif->arg_types[i]; - bytes = FFI_ALIGN (bytes, t->alignment); +#if defined(X86_WIN32) + if (cabi == FFI_STDCALL) + bytes = FFI_ALIGN (bytes, FFI_SIZEOF_ARG); + else +#endif + bytes = FFI_ALIGN (bytes, t->alignment); bytes += FFI_ALIGN (t->size, FFI_SIZEOF_ARG); } cif->bytes = bytes; @@ -378,7 +383,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, cases. */ if (t == FFI_TYPE_STRUCT && ty->alignment >= 16) align = 16; - + if (dir < 0) { /* ??? These reverse argument ABIs are probably too old |