This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Intel compiler bug


Dear libffi devs,

You're probably already aware (I'm sure I've written before and there was a 
stackoverflow question about it), but there seems to be a bug which breaks the 
libffi build, when using the Intel compiler on Linux x86_64 machines.

I applied a hack to the x86/ffi64.c in my python build directory which gets it 
to compile, and I've just tried it on a git pull of libffi. I can't get past the 
'make' stage without, but with the below patch, 'make check' passes 1659 
tests, skipping another 55.

There's an open python bug report (issue 4130), where they're awaiting for 
this to be fixed upstream. I'm sure someone write something nicer - this is 
just hacked together from a bit of code I found on Intel's forums -  but it 
seems to work..

Anyway, hope it helps,
Cheers,
Alex


# diff -u src/x86/ffi64.c.orig src/x86/ffi64.c

--- src/x86/ffi64.c.orig        2012-07-16 11:38:34.681045084 +0100
+++ src/x86/ffi64.c     2012-07-16 22:34:42.959552750 +0100
@@ -38,7 +38,7 @@
 #define MAX_SSE_REGS 8
 
 #ifdef __INTEL_COMPILER
-#define UINT128 __m128
+typedef struct { int64_t m[2]; } __int128_t;
 #else
 #define UINT128 __int128_t
 #endif
@@ -47,7 +47,7 @@
 {
   /* Registers for argument passing.  */
   UINT64 gpr[MAX_GPR_REGS];
-  UINT128 sse[MAX_SSE_REGS];
+  __int128_t sse[MAX_SSE_REGS];
 };
 
 extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
@@ -477,10 +477,20 @@
                  break;
                case X86_64_SSE_CLASS:
                case X86_64_SSEDF_CLASS:
+#ifdef __INTEL_COMPILER
+                 reg_args->sse[ssecount].m[0] = *(UINT64 *) a;
+                 reg_args->sse[ssecount++].m[1] = 0;
+#else
                  reg_args->sse[ssecount++] = *(UINT64 *) a;
+#endif
                  break;
                case X86_64_SSESF_CLASS:
+#ifdef __INTEL_COMPILER
+                 reg_args->sse[ssecount].m[0] = *(UINT32 *) a;
+                 reg_args->sse[ssecount++].m[1] = 0;
+#else
                  reg_args->sse[ssecount++] = *(UINT32 *) a;
+#endif
                  break;
                default:
                  abort();



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]