summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Kanis <lars@greiz-reinsdorf.de>2023-01-27 18:42:58 +0100
committerLars Kanis <lars@greiz-reinsdorf.de>2023-04-14 17:08:32 +0200
commit55e2b5921b7ca73b8a6b7bfb7f8e0b3889d9a74b (patch)
treee001bc2b24881c19252cfce2a3fa122e347b7cd2
parentd66ab081bb943bc3f2eeb4940dd34c28e92927d3 (diff)
downloadffi-55e2b5921b7ca73b8a6b7bfb7f8e0b3889d9a74b.tar.gz
Disable custom trampoline when using libffi closure allocation
This is because libffi changed the way how closures are allocated to static trampolines. `codeloc` is an opaque pointer now, to the internal `struct tramp` struct - and not to executable code. The executable code of trampolines is static and no longer written or writable at runtime.
-rw-r--r--ext/ffi_c/MethodHandle.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/ffi_c/MethodHandle.c b/ext/ffi_c/MethodHandle.c
index d047e10..83f7b77 100644
--- a/ext/ffi_c/MethodHandle.c
+++ b/ext/ffi_c/MethodHandle.c
@@ -77,7 +77,9 @@
static bool prep_trampoline(void* ctx, void* code, Closure* closure, char* errmsg, size_t errmsgsize);
static long trampoline_size(void);
-#if defined(__x86_64__) && (defined(__linux__) || defined(__APPLE__))
+#if defined(__x86_64__) && \
+ (defined(__linux__) || defined(__APPLE__)) && \
+ !USE_FFI_ALLOC
# define CUSTOM_TRAMPOLINE 1
#endif