Skip to content

Commit

Permalink
erts: Disable native stack if we can't make it signal-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
jhogberg committed Nov 19, 2020
1 parent f206974 commit 5d98ec5
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions erts/configure.in
Expand Up @@ -2900,9 +2900,25 @@ if test ${enable_jit} != no; then
# https://undeadly.org/cgi?action=article;sid=20180310000858
;;
*)
# By default, BEAMASM will use the native stack.
AC_DEFINE(NATIVE_ERLANG_STACK, [],
[Define if we can use the native stack for Erlang code])
# Use the native stack if we can safely redirect OS signals to a
# different stack.
AC_MSG_CHECKING([for safe signal delivery])
AC_TRY_COMPILE(
[#include <signal.h>],
[#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
#define __DARWIN__ 1
#endif
#if !(defined(__GLIBC__) || defined(__DARWIN__) ||
defined(__NetBSD__) || defined(__FreeBSD__) ||
defined(__sun__) || defined(__WIN32__))
/* Unknown libc -- assume musl, which does not allow safe signals. */
#error "unknown libc"
#endif],
[AC_MSG_RESULT([yes])
AC_DEFINE(NATIVE_ERLANG_STACK, [],
[Define if we can use the native stack for Erlang code])],
[AC_MSG_WARN([no, disabling native stack in JIT])]
)
;;
esac
fi
Expand Down

0 comments on commit 5d98ec5

Please sign in to comment.