From d56460c939c94a6c547abe8238f442b8de10bfbd Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 12 Nov 2015 15:50:26 -0500 Subject: unify static and dynamic linked implementations of thread-local storage this both allows removal of some of the main remaining uses of the SHARED macro and clears one obstacle to static-linked dlopen support, which may be added at some point in the future. specialized single-TLS-module versions of __copy_tls and __reset_tls are removed and replaced with code adapted from their dynamic-linked versions, capable of operating on a whole chain of TLS modules, and use of the dynamic linker's DSO chain (which contains large struct dso objects) by these functions is replaced with a new chain of struct tls_module objects containing only the information needed for implementing TLS. this may also yield some performance benefit initializing TLS for a new thread when a large number of modules without TLS have been loaded, since since there is no need to walk structures for modules without TLS. --- src/internal/libc.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/internal/libc.h') diff --git a/src/internal/libc.h b/src/internal/libc.h index 98c7535a..5e145183 100644 --- a/src/internal/libc.h +++ b/src/internal/libc.h @@ -11,13 +11,20 @@ struct __locale_struct { const struct __locale_map *volatile cat[6]; }; +struct tls_module { + struct tls_module *next; + void *image; + size_t len, size, align, offset; +}; + struct __libc { int can_do_threads; int threaded; int secure; volatile int threads_minus_1; size_t *auxv; - size_t tls_size; + struct tls_module *tls_head; + size_t tls_size, tls_align, tls_cnt; size_t page_size; struct __locale_struct global_locale; }; -- cgit v1.2.1