From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 03/10] nptl: Move semi-public __pthread_get_minstack symbol into libc
Date: Tue, 18 May 2021 16:25:05 +0200 [thread overview]
Message-ID: <ffb3b0dc4aad2b4b8faf8543348305cd79a623b7.1621347402.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1621347402.git.fweimer@redhat.com>
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 <adhemerval.zanella@linaro.org>
---
nptl/Versions | 2 +-
nptl/nptl-init.c | 19 -------------------
nptl/nptl-stack.c | 17 +++++++++++++++++
nptl/pthreadP.h | 1 +
nptl/pthread_create.c | 4 ++++
5 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/nptl/Versions b/nptl/Versions
index d96b830d05..845001847b 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -408,6 +408,7 @@ libc {
__pthread_disable_asynccancel;
__pthread_enable_asynccancel;
__pthread_force_elision;
+ __pthread_get_minstack;
__pthread_getattr_default_np;
__pthread_getattr_default_np;
__pthread_keys;
@@ -510,7 +511,6 @@ libpthread {
GLIBC_PRIVATE {
__pthread_clock_gettime;
__pthread_clock_settime;
- __pthread_get_minstack;
__pthread_initialize_minimal;
}
}
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 732e580355..5a460aedba 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -38,28 +38,9 @@
#include <pthread_mutex_conf.h>
#include <nptl-stack.h>
-/* Version of the library, used in libthread_db to detect mismatches. */
-static const char nptl_version[] __attribute_used__ = VERSION;
-
void
__pthread_initialize_minimal_internal (void)
{
}
strong_alias (__pthread_initialize_minimal_internal,
__pthread_initialize_minimal)
-
-
-/* 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);
-}
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 <nptl-stack.h>
#include <ldsodefs.h>
+#include <pthreadP.h>
/* 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)
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index d011a0ec34..3151842891 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -343,6 +343,7 @@ extern unsigned long int __fork_generation attribute_hidden;
extern unsigned long int *__fork_generation_pointer attribute_hidden;
extern size_t __pthread_get_minstack (const pthread_attr_t *attr);
+libc_hidden_proto (__pthread_get_minstack)
/* Namespace save aliases. */
extern int __pthread_getschedparam (pthread_t thread_id, int *policy,
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 772b5efcc6..438b8a7ae1 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -36,6 +36,7 @@
#include <tls-setup.h>
#include "libioP.h"
#include <sys/single_threaded.h>
+#include <version.h>
#include <shlib-compat.h>
@@ -56,6 +57,9 @@ static struct rtld_global *__nptl_rtld_global __attribute_used__
= &_rtld_global;
#endif
+/* Version of the library, used in libthread_db to detect mismatches. */
+static const char nptl_version[] __attribute_used__ = VERSION;
+
/* This performs the initialization necessary when going from
single-threaded to multi-threaded mode for the first time. */
static void
--
2.31.1
next prev parent reply other threads:[~2021-05-18 14:26 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 14:24 [PATCH 00/10] nptl: Complete libpthread removal Florian Weimer
2021-05-18 14:24 ` [PATCH 01/10] nptl: Perform signal initialization upon pthread_create Florian Weimer
2021-05-20 19:15 ` Adhemerval Zanella
2021-05-20 19:41 ` Florian Weimer
2021-05-20 19:57 ` Adhemerval Zanella
2021-05-20 20:05 ` Florian Weimer
2021-05-20 20:32 ` Adhemerval Zanella
2021-05-21 9:58 ` Florian Weimer
2021-05-21 11:31 ` Adhemerval Zanella
2021-05-21 12:40 ` Adhemerval Zanella
2021-05-18 14:24 ` [PATCH 02/10] nptl: Eliminate the __static_tls_size, __static_tls_align_m1 variables Florian Weimer
2021-05-18 14:25 ` Florian Weimer [this message]
2021-05-18 14:25 ` [PATCH 04/10] elf: Use custom NODELETE DSO for tst-dlopenfail, tst-dlopenfail-2 Florian Weimer
2021-05-20 20:36 ` Adhemerval Zanella
2021-05-18 14:25 ` [PATCH 05/10] nptl: Move pthread_create, thrd_create into libc Florian Weimer
2021-05-20 20:44 ` Adhemerval Zanella
2021-05-18 14:25 ` [PATCH 06/10] nptl: Remove unused __libc_pthread_init function Florian Weimer
2021-05-18 14:49 ` Andreas Schwab
2021-05-18 14:25 ` [PATCH 07/10] nptl: Remove remaining code from libpthread Florian Weimer
2021-05-20 20:49 ` Adhemerval Zanella
2021-05-18 14:25 ` [PATCH 08/10] elf: Do not load libpthread for PTHREAD_IN_LIBC Florian Weimer
2021-05-20 20:53 ` Adhemerval Zanella
2021-05-21 19:15 ` Florian Weimer
2021-05-18 14:25 ` [PATCH 09/10] elf: Add facility to create stub DSOs in elf/stub-dsos Florian Weimer
2021-05-24 18:24 ` Adhemerval Zanella
2021-05-24 18:25 ` Adhemerval Zanella
2021-05-18 14:25 ` [PATCH 10/10] nptl: Stop building libpthread Florian Weimer
2021-05-18 14:56 ` [PATCH 00/10] nptl: Complete libpthread removal Andreas Schwab
2021-05-18 15:04 ` Florian Weimer
2021-05-18 15:26 ` Andreas Schwab
2021-05-18 15:51 ` Florian Weimer
2021-05-18 16:27 ` Andreas Schwab
2021-05-18 16:31 ` Florian Weimer
2021-05-18 16:47 ` Andreas Schwab
2021-05-20 13:27 ` Florian Weimer
2021-05-20 13:50 ` Andreas Schwab
2021-05-20 13:54 ` Florian Weimer
2021-05-20 14:01 ` Andreas Schwab
2021-05-20 15:09 ` H.J. Lu
2021-05-20 15:13 ` Florian Weimer
2021-05-20 15:17 ` Andreas Schwab
2021-05-20 15:35 ` H.J. Lu
2021-05-20 15:39 ` Florian Weimer
2021-05-20 15:57 ` H.J. Lu
2021-05-19 11:57 ` Szabolcs Nagy
2021-05-19 12:35 ` Florian Weimer
2021-05-19 13:14 ` Szabolcs Nagy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ffb3b0dc4aad2b4b8faf8543348305cd79a623b7.1621347402.git.fweimer@redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).