Commit 8bf987d4df7c4d21435b9211f6cc86abf5904b42

Anthony Green 2013-01-10T17:24:51

Fix for sunpro compiler on Solaris

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();