summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2021-06-27 16:50:20 +0100
committerGitHub <noreply@github.com>2021-06-27 11:50:20 -0400
commit132699b95d3ee4d889ea2a80540acf3300987dad (patch)
tree5bf6bb30cad26a8f9f02318d671b149cf8bf3724 /configure.ac
parent4e07374c2773711902ec12905d5c64d95d22d050 (diff)
downloadlibffi-132699b95d3ee4d889ea2a80540acf3300987dad.tar.gz
configure.ac: add --disable-exec-static-tramp flag (#647)
Some projects like GHC (Glasgow Haskell Compiler) and gobject-introspection use `ffi_closure_alloc()` as a way to allocate executable memory. exec static tramp interferes with it (unclear how exactly yet). GHC symptom: ffi closure freeing cimplains about unexpected trampoline (GHC manually fills one): ``` $ ghci GHCi, version 8.10.5: https://www.haskell.org/ghc/ :? for help ghc: freeHaskellFunctionPtr: not for me, guv! 0x7f0417a1efe8 ghc: freeHaskellFunctionPtr: not for me, guv! 0x7f0417a1efc8 ``` gobject-introspection symptom: ``` $ meld Segmentation fault (core dumped) $ gdb --args /usr/bin/python3.9 /usr/bin/meld (gdb) run ... Thread 1 "python3.9" received signal SIGSEGV, Segmentation fault. 0x00007fffe9ac1ae8 in g_callable_info_free_closure ( callable_info=0x555555d45990, closure=0x7fffe9e70c20) at ../gobject-introspection-1.68.0/girepository/girffi.c:428 428 g_free (wrapper->ffi_closure.cif->arg_types); (gdb) bt callable_info=0x555555d45990, closure=0x7fffe9e70c20) at ../gobject-introspection-1.68.0/girepository/girffi.c:428 data=0x555555d252d0) at ../pygobject-3.40.1/gi/pygi-closure.c:635 ... ``` To ease downstreams narrowing down the actual problem let's provide a knob to disable exec static trampolines. The change for not affect current default. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac5
1 files changed, 5 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 21d4f85..b3e78f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -366,6 +366,10 @@ AC_ARG_ENABLE(raw-api,
AC_DEFINE(FFI_NO_RAW_API, 1, [Define this if you do not want support for the raw API.])
fi)
+AC_ARG_ENABLE(exec-static-tramp,
+[ --disable-exec-static-tramp disable use of static exec trampolines (enabled by default)])
+
+if test "$enable_exec_static_tramp" != no; then
case "$target" in
*-cygwin*)
;;
@@ -374,6 +378,7 @@ case "$target" in
[Define this if you want statically defined trampolines])
;;
esac
+fi
AC_ARG_ENABLE(purify-safety,
[ --enable-purify-safety purify-safe mode],