Add tls_model configuration.
The tls_model attribute isn't supporte by clang (yet?), so add a configure test that defines JEMALLOC_TLS_MODEL appropriately.
This commit is contained in:
parent
01b3fe55ff
commit
3cc1f1aa69
17
configure.ac
17
configure.ac
@ -285,6 +285,21 @@ if test "x${je_cv_attribute}" = "xyes" ; then
|
|||||||
JE_CFLAGS_APPEND([-fvisibility=hidden])
|
JE_CFLAGS_APPEND([-fvisibility=hidden])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
dnl Check for tls_model attribute support (clang 3.0 still lacks support).
|
||||||
|
SAVED_CFLAGS="${CFLAGS}"
|
||||||
|
JE_CFLAGS_APPEND([-Werror])
|
||||||
|
JE_COMPILABLE([tls_model attribute], [],
|
||||||
|
[static __thread int
|
||||||
|
__attribute__((tls_model("initial-exec"))) foo;
|
||||||
|
foo = 0;],
|
||||||
|
[je_cv_tls_model])
|
||||||
|
CFLAGS="${SAVED_CFLAGS}"
|
||||||
|
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
|
||||||
|
|
||||||
JE_COMPILABLE([mremap(...MREMAP_FIXED...)], [
|
JE_COMPILABLE([mremap(...MREMAP_FIXED...)], [
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
@ -719,7 +734,7 @@ AC_CACHE_CHECK([STATIC_PAGE_SHIFT],
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fprintf(f, "%u\n", ffs((int)result) - 1);
|
fprintf(f, "%u\n", ffs((int)result) - 1);
|
||||||
close(f);
|
fclose(f);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
]])],
|
]])],
|
||||||
|
@ -87,14 +87,14 @@ extern bool a_name##_booted;
|
|||||||
/* malloc_tsd_data(). */
|
/* malloc_tsd_data(). */
|
||||||
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
|
||||||
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
||||||
a_attr __thread a_type JEMALLOC_ATTR(tls_model("initial-exec")) \
|
a_attr __thread a_type JEMALLOC_TLS_MODEL \
|
||||||
a_name##_tls = a_initializer; \
|
a_name##_tls = a_initializer; \
|
||||||
a_attr __thread bool JEMALLOC_ATTR(tls_model("initial-exec")) \
|
a_attr __thread bool JEMALLOC_TLS_MODEL \
|
||||||
a_name##_initialized = false; \
|
a_name##_initialized = false; \
|
||||||
a_attr bool a_name##_booted = false;
|
a_attr bool a_name##_booted = false;
|
||||||
#elif (defined(JEMALLOC_TLS))
|
#elif (defined(JEMALLOC_TLS))
|
||||||
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
|
||||||
a_attr __thread a_type JEMALLOC_ATTR(tls_model("initial-exec")) \
|
a_attr __thread a_type JEMALLOC_TLS_MODEL \
|
||||||
a_name##_tls = a_initializer; \
|
a_name##_tls = a_initializer; \
|
||||||
a_attr pthread_key_t a_name##_tsd; \
|
a_attr pthread_key_t a_name##_tsd; \
|
||||||
a_attr bool a_name##_booted = false;
|
a_attr bool a_name##_booted = false;
|
||||||
|
@ -108,6 +108,9 @@
|
|||||||
# define JEMALLOC_ATTR(s) JEMALLOC_CATTR(s,)
|
# define JEMALLOC_ATTR(s) JEMALLOC_CATTR(s,)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Non-empty if the tls_model attribute is supported. */
|
||||||
|
#undef JEMALLOC_TLS_MODEL
|
||||||
|
|
||||||
/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
|
/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
|
||||||
#undef JEMALLOC_CC_SILENCE
|
#undef JEMALLOC_CC_SILENCE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user