Fix for sunpro compiler on Solaris
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
diff --git a/ChangeLog b/ChangeLog
index 874e479..f572366 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-01-10 Anthony Green <green@moxielogic.com>
+ * src/x86/ffi64.c (struct register_args): Make sse array and array
+ of unions for sunpro compiler compatibility.
+
+2013-01-10 Anthony Green <green@moxielogic.com>
+
* configure.ac: Test target platform size_t size. Handle both 32
and 64-bit builds for x86_64-* and i?86-* targets (allowing for
CFLAG option to change default settings).
diff --git a/src/x86/ffi64.c b/src/x86/ffi64.c
index 1daa1c0..b8a823d 100644
--- a/src/x86/ffi64.c
+++ b/src/x86/ffi64.c
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------
- ffi64.c - Copyright (c) 20011 Anthony Green
+ ffi64.c - Copyright (c) 2013 The Written Word, Inc.
+ Copyright (c) 2011 Anthony Green
Copyright (c) 2008, 2010 Red Hat, Inc.
Copyright (c) 2002, 2007 Bo Thorsen <bo@suse.de>
@@ -37,17 +38,29 @@
#define MAX_GPR_REGS 6
#define MAX_SSE_REGS 8
-#ifdef __INTEL_COMPILER
+#if defined(__INTEL_COMPILER)
#define UINT128 __m128
#else
+#if defined(__SUNPRO_C)
+#include <sunmedia_types.h>
+#define UINT128 __m128i
+#else
#define UINT128 __int128_t
#endif
+#endif
+
+union big_int_union
+{
+ UINT32 i32;
+ UINT64 i64;
+ UINT128 i128;
+};
struct register_args
{
/* Registers for argument passing. */
UINT64 gpr[MAX_GPR_REGS];
- UINT128 sse[MAX_SSE_REGS];
+ union big_int_union sse[MAX_SSE_REGS];
};
extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
@@ -477,10 +490,10 @@ ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
break;
case X86_64_SSE_CLASS:
case X86_64_SSEDF_CLASS:
- reg_args->sse[ssecount++] = *(UINT64 *) a;
+ reg_args->sse[ssecount++].i64 = *(UINT64 *) a;
break;
case X86_64_SSESF_CLASS:
- reg_args->sse[ssecount++] = *(UINT32 *) a;
+ reg_args->sse[ssecount++].i32 = *(UINT32 *) a;
break;
default:
abort();