diff options
author | Qi Wang <interwq@gwu.edu> | 2019-04-15 22:36:31 (GMT) |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2019-04-16 18:07:15 (GMT) |
commit | 1aabab5fdca1cd76be3900e9272ef83549006ac0 (patch) | |
tree | 8b82e8b784a4c9c0c6867df1278a4a41a6245f7a | |
parent | 21cfe59ff7b10a61dabe26cd3dbfb7a255e1f5e8 (diff) | |
download | jemalloc-1aabab5fdca1cd76be3900e9272ef83549006ac0.zip jemalloc-1aabab5fdca1cd76be3900e9272ef83549006ac0.tar.gz jemalloc-1aabab5fdca1cd76be3900e9272ef83549006ac0.tar.bz2 |
Enforce TLS_MODEL attribute.
Caught by @zoulasc in #1460. The attribute needs to be added in the headers as
well.
-rw-r--r-- | include/jemalloc/internal/tsd_malloc_thread_cleanup.h | 6 | ||||
-rw-r--r-- | include/jemalloc/internal/tsd_tls.h | 4 | ||||
-rw-r--r-- | src/tsd.c | 6 |
3 files changed, 10 insertions, 6 deletions
diff --git a/include/jemalloc/internal/tsd_malloc_thread_cleanup.h b/include/jemalloc/internal/tsd_malloc_thread_cleanup.h index bf8801e..65852d5 100644 --- a/include/jemalloc/internal/tsd_malloc_thread_cleanup.h +++ b/include/jemalloc/internal/tsd_malloc_thread_cleanup.h @@ -3,8 +3,10 @@ #endif #define JEMALLOC_INTERNAL_TSD_MALLOC_THREAD_CLEANUP_H -extern __thread tsd_t tsd_tls; -extern __thread bool tsd_initialized; +#define JEMALLOC_TSD_TYPE_ATTR(type) __thread type JEMALLOC_TLS_MODEL + +extern JEMALLOC_TSD_TYPE_ATTR(tsd_t) tsd_tls; +extern JEMALLOC_TSD_TYPE_ATTR(bool) tsd_initialized; extern bool tsd_booted; /* Initialization/cleanup. */ diff --git a/include/jemalloc/internal/tsd_tls.h b/include/jemalloc/internal/tsd_tls.h index f4f165c..7d6c805 100644 --- a/include/jemalloc/internal/tsd_tls.h +++ b/include/jemalloc/internal/tsd_tls.h @@ -3,7 +3,9 @@ #endif #define JEMALLOC_INTERNAL_TSD_TLS_H -extern __thread tsd_t tsd_tls; +#define JEMALLOC_TSD_TYPE_ATTR(type) __thread type JEMALLOC_TLS_MODEL + +extern JEMALLOC_TSD_TYPE_ATTR(tsd_t) tsd_tls; extern pthread_key_t tsd_tsd; extern bool tsd_booted; @@ -17,11 +17,11 @@ JEMALLOC_DIAGNOSTIC_PUSH JEMALLOC_DIAGNOSTIC_IGNORE_MISSING_STRUCT_FIELD_INITIALIZERS #ifdef JEMALLOC_MALLOC_THREAD_CLEANUP -__thread tsd_t JEMALLOC_TLS_MODEL tsd_tls = TSD_INITIALIZER; -__thread bool JEMALLOC_TLS_MODEL tsd_initialized = false; +JEMALLOC_TSD_TYPE_ATTR(tsd_t) tsd_tls = TSD_INITIALIZER; +JEMALLOC_TSD_TYPE_ATTR(bool) JEMALLOC_TLS_MODEL tsd_initialized = false; bool tsd_booted = false; #elif (defined(JEMALLOC_TLS)) -__thread tsd_t JEMALLOC_TLS_MODEL tsd_tls = TSD_INITIALIZER; +JEMALLOC_TSD_TYPE_ATTR(tsd_t) tsd_tls = TSD_INITIALIZER; pthread_key_t tsd_tsd; bool tsd_booted = false; #elif (defined(_WIN32)) |