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.
This commit is contained in:
parent
e40b2f75bd
commit
a62e42baeb
@ -265,6 +265,15 @@ any of the following arguments (not a definitive list) to 'configure':
|
|||||||
configuration, jemalloc will provide additional size classes that are not
|
configuration, jemalloc will provide additional size classes that are not
|
||||||
16-byte-aligned (24, 40, and 56).
|
16-byte-aligned (24, 40, and 56).
|
||||||
|
|
||||||
|
* `--disable-initial-exec-tls`
|
||||||
|
|
||||||
|
Disable the initial-exec TLS model for jemalloc's internal thread-local
|
||||||
|
storage (on those platforms that support explicit settings). This can allow
|
||||||
|
jemalloc to be dynamically loaded after program starup (e.g. using dlopen).
|
||||||
|
Note that in this case, there will be two malloc implementations operating
|
||||||
|
in the same process, which will almost certainly result in confusing runtime
|
||||||
|
crashes if pointers leak from one implementation to the other.
|
||||||
|
|
||||||
The following environment variables (not a definitive list) impact configure's
|
The following environment variables (not a definitive list) impact configure's
|
||||||
behavior:
|
behavior:
|
||||||
|
|
||||||
|
32
configure.ac
32
configure.ac
@ -733,12 +733,9 @@ JE_COMPILABLE([tls_model attribute], [],
|
|||||||
foo = 0;],
|
foo = 0;],
|
||||||
[je_cv_tls_model])
|
[je_cv_tls_model])
|
||||||
JE_CFLAGS_RESTORE()
|
JE_CFLAGS_RESTORE()
|
||||||
if test "x${je_cv_tls_model}" = "xyes" ; then
|
dnl (Setting of JEMALLOC_TLS_MODEL is done later, after we've checked for
|
||||||
AC_DEFINE([JEMALLOC_TLS_MODEL],
|
dnl --disable-initial-exec-tls)
|
||||||
[__attribute__((tls_model("initial-exec")))])
|
|
||||||
else
|
|
||||||
AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
|
|
||||||
fi
|
|
||||||
dnl Check for alloc_size attribute support.
|
dnl Check for alloc_size attribute support.
|
||||||
JE_CFLAGS_SAVE()
|
JE_CFLAGS_SAVE()
|
||||||
JE_CFLAGS_ADD([-Werror])
|
JE_CFLAGS_ADD([-Werror])
|
||||||
@ -1993,6 +1990,29 @@ if test "x${enable_zone_allocator}" = "x1" ; then
|
|||||||
AC_DEFINE([JEMALLOC_ZONE], [ ])
|
AC_DEFINE([JEMALLOC_ZONE], [ ])
|
||||||
fi
|
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 ============================================================================
|
||||||
dnl Enable background threads if possible.
|
dnl Enable background threads if possible.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user