Forcibly disable TLS on OS X.

Forcibly disable TLS on OS X.  gcc and llvm-gcc on OS X do not support
TLS, but clang does.  Unfortunately, the implementation calls malloc()
internally during TLS initialization, which causes an unresolvable
bootstrapping issue.
This commit is contained in:
Jason Evans 2012-03-23 16:17:43 -07:00
parent 9022bf9bfd
commit b80581d309

View File

@ -214,6 +214,7 @@ case "${host}" in
RPATH="" RPATH=""
LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
so="dylib" so="dylib"
force_tls="0"
;; ;;
*-*-freebsd*) *-*-freebsd*)
CFLAGS="$CFLAGS" CFLAGS="$CFLAGS"
@ -767,7 +768,6 @@ dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
dnl it rather than pthreads TSD cleanup functions to support cleanup during dnl it rather than pthreads TSD cleanup functions to support cleanup during
dnl thread exit, in order to avoid pthreads library recursion during dnl thread exit, in order to avoid pthreads library recursion during
dnl bootstrapping. dnl bootstrapping.
force_tls="0"
AC_CHECK_FUNC([_malloc_thread_cleanup], AC_CHECK_FUNC([_malloc_thread_cleanup],
[have__malloc_thread_cleanup="1"], [have__malloc_thread_cleanup="1"],
[have__malloc_thread_cleanup="0"] [have__malloc_thread_cleanup="0"]
@ -813,6 +813,10 @@ if test "x${enable_tls}" = "x0" -a "x${force_tls}" = "x1" ; then
AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues]) AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues])
enable_tls="1" enable_tls="1"
fi fi
if test "x${enable_tls}" = "x1" -a "x${force_tls}" = "x0" ; then
AC_MSG_RESULT([Forcing no TLS to avoid allocator/threading bootstrap issues])
enable_tls="0"
fi
if test "x${enable_tls}" = "x1" ; then if test "x${enable_tls}" = "x1" ; then
AC_MSG_CHECKING([for TLS]) AC_MSG_CHECKING([for TLS])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( AC_COMPILE_IFELSE([AC_LANG_PROGRAM(