]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/tools/vcpkg/ports/libffi/win64-disable-stackframe-check.patch
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / tools / vcpkg / ports / libffi / win64-disable-stackframe-check.patch
CommitLineData
1e59de90
TL
1From 53291b332b1bc061a3409d3b60c38f313609b98e Mon Sep 17 00:00:00 2001
2From: Matthew Waters <matthew@centricular.com>
3Date: Fri, 16 Mar 2018 15:10:04 +1100
4Subject: [PATCH] x86/win64: disable runtime stack frame checks with msvc
5 around built assembly
6
7MSVC can add truntime code that checks if a stack frame is mismanaged
8however our custom assembly delibrately accesses and modifies the parent
9stack frame. Fortunately we can disable that specific check for the
10function call so do that.
11---
12 src/x86/ffiw64.c | 11 +++++++++++
13 1 file changed, 11 insertions(+)
14
15diff --git a/src/x86/ffiw64.c b/src/x86/ffiw64.c
16index f7875252..88bb3a34 100644
17--- a/src/x86/ffiw64.c
18+++ b/src/x86/ffiw64.c
19@@ -106,6 +106,14 @@ EFI64(ffi_prep_cif_machdep)(ffi_cif *cif)
20 return FFI_OK;
21 }
22
23+/* we perform some black magic here to use some of the parent's
24+ * stack frame in ff_call_win64() that breaks with the msvc compiler
25+ * with the /RTCs or /GZ flags. Disable the 'Stack frame run time
26+ * error checking' for this function so we don't hit weird exceptions
27+ * in debug builds */
28+#if defined(_MSC_VER)
29+#pragma runtime_checks("s", off)
30+#endif
31 static void
32 ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
33 void **avalue, void *closure)
34@@ -170,6 +178,9 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
35
36 ffi_call_win64 (stack, frame, closure);
37 }
38+#if defined(_MSC_VER)
39+#pragma runtime_checks("s", restore)
40+#endif
41
42 void
43 EFI64(ffi_call)(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)