1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
Index: libffi/ChangeLog
===================================================================
--- libffi.orig/ChangeLog
+++ libffi/ChangeLog
@@ -225,6 +225,14 @@
* testsuite/libffi.call/cls_longdouble.c: Likewise.
* testsuite/libffi.call/huge_struct.c: Likewise.
+2010-08-04 Dan Witte <dwitte@mozilla.com>
+
+ * src/x86/ffitarget.h: Add X86_ANY define for all x86/x86_64
+ platforms.
+ * src/x86/ffi.c: Remove redundant ifdef checks.
+ * src/prep_cif.c: Push stack space computation into src/x86/ffi.c
+ for X86_ANY so return value space doesn't get added twice.
+
2010-07-22 Dan Witte <dwitte@mozilla.com>
* src/*/ffitarget.h: Make FFI_LAST_ABI one past the last valid ABI.
Index: libffi/src/prep_cif.c
===================================================================
--- libffi.orig/src/prep_cif.c
+++ libffi/src/prep_cif.c
@@ -110,7 +110,7 @@ ffi_status ffi_prep_cif(ffi_cif *cif, ff
FFI_ASSERT_VALID_TYPE(cif->rtype);
/* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */
-#if !defined M68K && !defined __i386__ && !defined __x86_64__ && !defined S390 && !defined PA
+#if !defined M68K && !defined X86_ANY && !defined S390 && !defined PA
/* Make space for the return structure pointer */
if (cif->rtype->type == FFI_TYPE_STRUCT
#ifdef SPARC
@@ -131,7 +131,7 @@ ffi_status ffi_prep_cif(ffi_cif *cif, ff
check after the initialization. */
FFI_ASSERT_VALID_TYPE(*ptr);
-#if !defined __i386__ && !defined __x86_64__ && !defined S390 && !defined PA
+#if !defined X86_ANY && !defined S390 && !defined PA
#ifdef SPARC
if (((*ptr)->type == FFI_TYPE_STRUCT
&& ((*ptr)->size > 16 || cif->abi != FFI_V9))
Index: libffi/src/x86/ffi.c
===================================================================
--- libffi.orig/src/x86/ffi.c
+++ libffi/src/x86/ffi.c
@@ -228,12 +228,10 @@ ffi_status ffi_prep_cif_machdep(ffi_cif
switch (cif->rtype->type)
{
case FFI_TYPE_VOID:
-#if defined(X86) || defined (X86_WIN32) || defined(X86_FREEBSD) || defined(X86_DARWIN) || defined(X86_WIN64)
case FFI_TYPE_UINT8:
case FFI_TYPE_UINT16:
case FFI_TYPE_SINT8:
case FFI_TYPE_SINT16:
-#endif
#ifdef X86_WIN64
case FFI_TYPE_UINT32:
case FFI_TYPE_SINT32:
Index: libffi/src/x86/ffitarget.h
===================================================================
--- libffi.orig/src/x86/ffitarget.h
+++ libffi/src/x86/ffitarget.h
@@ -32,6 +32,9 @@
/* ---- System specific configurations ----------------------------------- */
+/* For code common to all platforms on x86 and x86_64. */
+#define X86_ANY
+
#if defined (X86_64) && defined (__i386__)
#undef X86_64
#define X86
@@ -70,16 +73,14 @@ typedef enum ffi_abi {
FFI_LAST_ABI,
/* TODO: Add fastcall support for the sake of completeness */
FFI_DEFAULT_ABI = FFI_SYSV
-#endif
-#ifdef X86_WIN64
+#elif defined(X86_WIN64)
FFI_WIN64,
FFI_LAST_ABI,
FFI_DEFAULT_ABI = FFI_WIN64
-#else
+#else
/* ---- Intel x86 and AMD x86-64 - */
-#if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__) || defined(__i386) || defined(__amd64))
FFI_SYSV,
FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */
FFI_LAST_ABI,
@@ -89,7 +90,6 @@ typedef enum ffi_abi {
FFI_DEFAULT_ABI = FFI_UNIX64
#endif
#endif
-#endif /* X86_WIN64 */
} ffi_abi;
#endif