From 4f3410e759ec42cb307429222d690a81e3cd37b0 Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Sun, 21 Feb 2016 13:52:47 -0800 Subject: [PATCH] enable emergency malloc by default on arm when using libunwind Because by default libunwind on arm does fopen which mallocs which will deadlock unless we enable emergency malloc. --- configure.ac | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 02dab0b..298e603 100644 --- a/configure.ac +++ b/configure.ac @@ -266,6 +266,7 @@ if test "$enable_libunwind" = yes; then AC_CHECK_LIB(unwind, backtrace, UNWIND_LIBS=-lunwind, [AC_CHECK_LIB(execinfo, backtrace, UNWIND_LIBS=-lexecinfo, UNWIND_LIBS=)]) AC_SUBST(UNWIND_LIBS) + will_use_libunwind=yes else AC_CHECK_LIB(execinfo, backtrace, UNWIND_LIBS=-lexecinfo, UNWIND_LIBS=) AC_SUBST(UNWIND_LIBS) @@ -390,11 +391,19 @@ AC_CACHE_CHECK([if target has _Unwind_Backtrace], AS_IF([test "x$perftools_cv_have_unwind_backtrace" = xyes], [AC_DEFINE(HAVE_UNWIND_BACKTRACE, 1, [Whether contains _Unwind_Backtrace])]) +AS_IF([test "x$enable_backtrace" = xyes], + [default_emergency_malloc=yes], + [default_emergency_malloc=no]) + +AS_IF([test "x$will_use_libunwind" = xyes], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __arm__])], + [default_emergency_malloc=yes])]) + AC_ARG_ENABLE([emergency-malloc], [AS_HELP_STRING([--enable-emergency-malloc], [build emergency malloc feature])], [enable_emergency_malloc="$enableval"], - [enable_emergency_malloc="$enable_backtrace"]) + [enable_emergency_malloc="$default_emergency_malloc"]) AM_CONDITIONAL(BUILD_EMERGENCY_MALLOC, [test "x$enable_emergency_malloc" = xyes])