From 819a2b051f1dba9526f2338098fff6dd1700bdb6 Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Thu, 29 Aug 2013 19:00:31 +0300 Subject: issue-413: disable __thread usage on OSX Because it was found that __thread variables access is compiled into calls to tlv_get_addr which was found to call malloc. Because we actually use thread-local storage from inside malloc it leads to stack overflow. So we'll continue using pthreads API for that which is known to work on OSX. --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3d929de..28a9252 100644 --- a/configure.ac +++ b/configure.ac @@ -302,9 +302,10 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], AC_MSG_CHECKING([for __thread]) AC_LINK_IFELSE([AC_LANG_PROGRAM([#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) || (__GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ < 2)) #error gcc has this bug: http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html -#endif -#if defined(__MINGW32__) +#elif defined(__MINGW32__) #error mingw doesn't really support tls +#elif defined(__APPLE__) +#error OSX __thread support is known to call malloc which makes it unsafe to use from malloc replacement #endif ], [static __thread int p = 0])], [AC_DEFINE(HAVE_TLS, 1, -- cgit v1.2.1