| 1 |
https://github.com/libffi/libffi/pull/580 |
| 2 |
|
| 3 |
diff --git a/js/src/ctypes/libffi/src/x86/win64.S b/js/src/ctypes/libffi/src/x86/win64.S |
| 4 |
index 2c334c82f9b2d..a54459f077c91 100644 |
| 5 |
--- a/js/src/ctypes/libffi/src/x86/win64.S |
| 6 |
+++ b/js/src/ctypes/libffi/src/x86/win64.S |
| 7 |
@@ -25,17 +25,17 @@ |
| 8 |
|
| 9 |
/* This macro allows the safe creation of jump tables without an |
| 10 |
actual table. The entry points into the table are all 8 bytes. |
| 11 |
The use of ORG asserts that we're at the correct location. */ |
| 12 |
/* ??? The clang assembler doesn't handle .org with symbolic expressions. */ |
| 13 |
#if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__)) |
| 14 |
# define E(BASE, X) .balign 8 |
| 15 |
#else |
| 16 |
-# define E(BASE, X) .balign 8; .org BASE + X * 8 |
| 17 |
+# define E(BASE, X) .balign 8; .org BASE + (X) * 8 |
| 18 |
#endif |
| 19 |
|
| 20 |
.text |
| 21 |
|
| 22 |
/* ffi_call_win64 (void *stack, struct win64_call_frame *frame, void *r10) |
| 23 |
|
| 24 |
Bit o trickiness here -- FRAME is the base of the stack frame |
| 25 |
for this function. This has been allocated by ffi_call. We also |
| 26 |
@@ -102,17 +102,18 @@ E(0b, FFI_TYPE_INT) |
| 27 |
movq %rax, (%r8) |
| 28 |
epilogue |
| 29 |
E(0b, FFI_TYPE_FLOAT) |
| 30 |
movss %xmm0, (%r8) |
| 31 |
epilogue |
| 32 |
E(0b, FFI_TYPE_DOUBLE) |
| 33 |
movsd %xmm0, (%r8) |
| 34 |
epilogue |
| 35 |
-E(0b, FFI_TYPE_LONGDOUBLE) |
| 36 |
+// FFI_TYPE_LONGDOUBLE may be FFI_TYPE_DOUBLE but we need a different value here. |
| 37 |
+E(0b, FFI_TYPE_DOUBLE + 1) |
| 38 |
call PLT(C(abort)) |
| 39 |
E(0b, FFI_TYPE_UINT8) |
| 40 |
movzbl %al, %eax |
| 41 |
movq %rax, (%r8) |
| 42 |
epilogue |
| 43 |
E(0b, FFI_TYPE_SINT8) |
| 44 |
movsbq %al, %rax |
| 45 |
jmp 98f |
| 46 |
diff --git a/js/src/ctypes/libffi/src/x86/win64_intel.S b/js/src/ctypes/libffi/src/x86/win64_intel.S |
| 47 |
index 7df78b30e42c6..970a4f997a981 100644 |
| 48 |
--- a/js/src/ctypes/libffi/src/x86/win64_intel.S |
| 49 |
+++ b/js/src/ctypes/libffi/src/x86/win64_intel.S |
| 50 |
@@ -24,17 +24,17 @@ |
| 51 |
|
| 52 |
/* This macro allows the safe creation of jump tables without an |
| 53 |
actual table. The entry points into the table are all 8 bytes. |
| 54 |
The use of ORG asserts that we're at the correct location. */ |
| 55 |
/* ??? The clang assembler doesn't handle .org with symbolic expressions. */ |
| 56 |
#if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__)) |
| 57 |
# define E(BASE, X) ALIGN 8 |
| 58 |
#else |
| 59 |
-# define E(BASE, X) ALIGN 8; ORG BASE + X * 8 |
| 60 |
+# define E(BASE, X) ALIGN 8; ORG BASE + (X) * 8 |
| 61 |
#endif |
| 62 |
|
| 63 |
.CODE |
| 64 |
extern PLT(C(abort)):near |
| 65 |
extern C(ffi_closure_win64_inner):near |
| 66 |
|
| 67 |
/* ffi_call_win64 (void *stack, struct win64_call_frame *frame, void *r10) |
| 68 |
|
| 69 |
@@ -102,17 +102,18 @@ E(0b, FFI_TYPE_INT) |
| 70 |
mov qword ptr [r8], rax; movq %rax, (%r8) |
| 71 |
epilogue |
| 72 |
E(0b, FFI_TYPE_FLOAT) |
| 73 |
movss dword ptr [r8], xmm0 ; movss %xmm0, (%r8) |
| 74 |
epilogue |
| 75 |
E(0b, FFI_TYPE_DOUBLE) |
| 76 |
movsd qword ptr[r8], xmm0; movsd %xmm0, (%r8) |
| 77 |
epilogue |
| 78 |
-E(0b, FFI_TYPE_LONGDOUBLE) |
| 79 |
+// FFI_TYPE_LONGDOUBLE may be FFI_TYPE_DOUBLE but we need a different value here. |
| 80 |
+E(0b, FFI_TYPE_DOUBLE + 1) |
| 81 |
call PLT(C(abort)) |
| 82 |
E(0b, FFI_TYPE_UINT8) |
| 83 |
movzx eax, al ;movzbl %al, %eax |
| 84 |
mov qword ptr[r8], rax; movq %rax, (%r8) |
| 85 |
epilogue |
| 86 |
E(0b, FFI_TYPE_SINT8) |
| 87 |
movsx rax, al ; movsbq %al, %rax |
| 88 |
jmp L98 |