summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2018-04-17 19:52:22 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2018-04-18 02:22:01 (GMT)
commita62e42baebe09dc84aaff731faa6ff87fde6bc4e (patch)
tree4b5f2e297f94b95dc006add9b1d01b4753325ae5 /configure.ac
parente40b2f75bdfc830a9a53b2cad4fb7261d39cec93 (diff)
downloadjemalloc-a62e42baebe09dc84aaff731faa6ff87fde6bc4e.zip
jemalloc-a62e42baebe09dc84aaff731faa6ff87fde6bc4e.tar.gz
jemalloc-a62e42baebe09dc84aaff731faa6ff87fde6bc4e.tar.bz2
Add the --disable-initial-exec-tls configure option.
Right now we always make our TLS use the initial-exec model if the compiler supports it. This change allows configure-time disabling of this setting, which can be helpful when dynamically loading jemalloc is the only option.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac32
1 files changed, 26 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index e45970e..ba0b694 100644
--- a/configure.ac
+++ b/configure.ac
@@ -733,12 +733,9 @@ JE_COMPILABLE([tls_model attribute], [],
foo = 0;],
[je_cv_tls_model])
JE_CFLAGS_RESTORE()
-if test "x${je_cv_tls_model}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_TLS_MODEL],
- [__attribute__((tls_model("initial-exec")))])
-else
- AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
-fi
+dnl (Setting of JEMALLOC_TLS_MODEL is done later, after we've checked for
+dnl --disable-initial-exec-tls)
+
dnl Check for alloc_size attribute support.
JE_CFLAGS_SAVE()
JE_CFLAGS_ADD([-Werror])
@@ -1994,6 +1991,29 @@ if test "x${enable_zone_allocator}" = "x1" ; then
fi
dnl ============================================================================
+dnl Use initial-exec TLS by default.
+AC_ARG_ENABLE([initial-exec-tls],
+ [AS_HELP_STRING([--disable-initial-exec-tls],
+ [Disable the initial-exec tls model])],
+[if test "x$enable_initial_exec_tls" = "xno" ; then
+ enable_initial_exec_tls="0"
+else
+ enable_initial_exec_tls="1"
+fi
+],
+[enable_initial_exec_tls="1"]
+)
+AC_SUBST([enable_initial_exec_tls])
+
+if test "x${je_cv_tls_model}" = "xyes" -a \
+ "x${enable_initial_exec_tls}" = "x1" ; then
+ AC_DEFINE([JEMALLOC_TLS_MODEL],
+ [__attribute__((tls_model("initial-exec")))])
+else
+ AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
+fi
+
+dnl ============================================================================
dnl Enable background threads if possible.
if test "x${have_pthread}" = "x1" -a "x${have_dlsym}" = "x1" \