aboutsummaryrefslogtreecommitdiff
path: root/nptl/nptl-stack.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-21 22:35:00 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-21 22:35:00 +0200
commitd03511f48f49fcb9bec4305586c26ab5d0063022 (patch)
tree7608e5705c830e8c710e785e3bfc5a90e8986cb4 /nptl/nptl-stack.h
parent2f69522d460611b1018e15df6c238dda2d8d6609 (diff)
downloadglibc-d03511f48f49fcb9bec4305586c26ab5d0063022.tar
glibc-d03511f48f49fcb9bec4305586c26ab5d0063022.tar.gz
glibc-d03511f48f49fcb9bec4305586c26ab5d0063022.tar.bz2
glibc-d03511f48f49fcb9bec4305586c26ab5d0063022.zip
nptl: Eliminate the __static_tls_size, __static_tls_align_m1 variables
Use the __nptl_tls_static_size_for_stack inline function instead, and the GLRO (dl_tls_static_align) value directly. The computation of GLRO (dl_tls_static_align) in _dl_determine_tlsoffset ensures that the alignment is at least TLS_TCB_ALIGN, which at least STACK_ALIGN (see allocate_stack). Therefore, the additional rounding-up step is removed. ALso move the initialization of the default stack size from __pthread_initialize_minimal_internal to __pthread_early_init. This introduces an extra system call during single-threaded startup, but this simplifies the initialization sequence. No locking is needed around the writes to __default_pthread_attr because the process is single-threaded at this point. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl/nptl-stack.h')
-rw-r--r--nptl/nptl-stack.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/nptl/nptl-stack.h b/nptl/nptl-stack.h
index 8631b61816..a6bd8df77f 100644
--- a/nptl/nptl-stack.h
+++ b/nptl/nptl-stack.h
@@ -20,7 +20,8 @@
#ifndef _NPTL_STACK_H
#define _NPTL_STACK_H
-#include <descr.h>
+#include <nptl/descr.h>
+#include <ldsodefs.h>
#include <list.h>
#include <stdbool.h>
@@ -47,4 +48,12 @@ libc_hidden_proto (__nptl_deallocate_stack)
/* Free stacks until cache size is lower than LIMIT. */
void __nptl_free_stacks (size_t limit) attribute_hidden;
+/* Compute the size of the static TLS area based on data from the
+ dynamic loader. */
+static inline size_t
+__nptl_tls_static_size_for_stack (void)
+{
+ return roundup (GLRO (dl_tls_static_size), GLRO (dl_tls_static_align));
+}
+
#endif /* _NPTL_STACK_H */