From b8cdc3bba71140d9c122ebde01c5094db1889485 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 21 May 2021 22:35:00 +0200 Subject: nptl: Move semi-public __pthread_get_minstack symbol into libc No abilist updates here because it is a GLIBC_PRIVATE symbol. It's also necessary to move nptl_version into pthread_create, so that it still ends up in static binaries. Reviewed-by: Adhemerval Zanella --- nptl/nptl-stack.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'nptl/nptl-stack.c') diff --git a/nptl/nptl-stack.c b/nptl/nptl-stack.c index 7853c105be..1a0c460ba8 100644 --- a/nptl/nptl-stack.c +++ b/nptl/nptl-stack.c @@ -19,6 +19,7 @@ #include #include +#include /* Maximum size in kB of cache. 40MiBi by default. */ static const size_t stack_cache_maxsize = 40 * 1024 * 1024; @@ -128,3 +129,19 @@ __nptl_deallocate_stack (struct pthread *pd) lll_unlock (GL (dl_stack_cache_lock), LLL_PRIVATE); } libc_hidden_def (__nptl_deallocate_stack) + +/* This function is internal (it has a GLIBC_PRIVATE) version, but it + is widely used (either via weak symbol, or dlsym) to obtain the + __static_tls_size value. This value is then used to adjust the + value of the stack size attribute, so that applications receive the + full requested stack size, not diminished by the TCB and static TLS + allocation on the stack. Once the TCB is separately allocated, + this function should be removed or renamed (if it is still + necessary at that point). */ +size_t +__pthread_get_minstack (const pthread_attr_t *attr) +{ + return (GLRO(dl_pagesize) + __nptl_tls_static_size_for_stack () + + PTHREAD_STACK_MIN); +} +libc_hidden_def (__pthread_get_minstack) -- cgit 1.4.1