summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksey Kandratsenka <alk@tut.by>2013-08-29 19:00:31 +0300
committerAliaksey Kandratsenka <alk@tut.by>2013-08-29 19:41:25 +0300
commit819a2b051f1dba9526f2338098fff6dd1700bdb6 (patch)
tree5dc43e6416dc8b9e3f668023044eca396eabe142
parent43809080931127037ce6e748f37a28ce7489387d (diff)
downloadgperftools-819a2b051f1dba9526f2338098fff6dd1700bdb6.tar.gz
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.
-rw-r--r--configure.ac5
1 files 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 <unistd.h>],
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,