Don't use FFI_TYPE_LONGDOUBLE in the jump table in win64*.S (#580) It may have the same value as FFI_TYPE_DOUBLE per ffi.h, which possibly can make things go wrong with .org/ORG. For instance, GCC complains about "Error: attempt to move .org backwards"
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
diff --git a/src/x86/win64.S b/src/x86/win64.S
index 57c0e65..8315e8b 100644
--- a/src/x86/win64.S
+++ b/src/x86/win64.S
@@ -30,7 +30,7 @@
#if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__))
# define E(BASE, X) .balign 8
#else
-# define E(BASE, X) .balign 8; .org BASE + X * 8
+# define E(BASE, X) .balign 8; .org BASE + (X) * 8
#endif
.text
@@ -108,7 +108,8 @@ E(0b, FFI_TYPE_FLOAT)
E(0b, FFI_TYPE_DOUBLE)
movsd %xmm0, (%r8)
epilogue
-E(0b, FFI_TYPE_LONGDOUBLE)
+// FFI_TYPE_LONGDOUBLE may be FFI_TYPE_DOUBLE but we need a different value here.
+E(0b, FFI_TYPE_DOUBLE + 1)
call PLT(C(abort))
E(0b, FFI_TYPE_UINT8)
movzbl %al, %eax
diff --git a/src/x86/win64_intel.S b/src/x86/win64_intel.S
index 7df78b3..970a4f9 100644
--- a/src/x86/win64_intel.S
+++ b/src/x86/win64_intel.S
@@ -29,7 +29,7 @@
#if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__))
# define E(BASE, X) ALIGN 8
#else
-# define E(BASE, X) ALIGN 8; ORG BASE + X * 8
+# define E(BASE, X) ALIGN 8; ORG BASE + (X) * 8
#endif
.CODE
@@ -107,7 +107,8 @@ E(0b, FFI_TYPE_FLOAT)
E(0b, FFI_TYPE_DOUBLE)
movsd qword ptr[r8], xmm0; movsd %xmm0, (%r8)
epilogue
-E(0b, FFI_TYPE_LONGDOUBLE)
+// FFI_TYPE_LONGDOUBLE may be FFI_TYPE_DOUBLE but we need a different value here.
+E(0b, FFI_TYPE_DOUBLE + 1)
call PLT(C(abort))
E(0b, FFI_TYPE_UINT8)
movzx eax, al ;movzbl %al, %eax