public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 23/23] nptl: Move semi-public __pthread_get_minstack symbol into libc
Date: Wed, 12 May 2021 18:59:24 +0200	[thread overview]
Message-ID: <a8d79a3d86ce38fea916a49e0ff3f3208f68a2bf.1620838412.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1620838411.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.
---
 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 2097e517ae..016a9bef09 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 3e9da9c7ea..c6b82851bf 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -340,6 +340,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 43f3722f57..220edda917 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;
+
 /* Code to allocate and deallocate a stack.  */
 #include "allocatestack.c"
 
-- 
2.31.1


  parent reply	other threads:[~2021-05-12 16:59 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 16:57 [PATCH 00/23] nptl: Move almost all remaining functions " Florian Weimer
2021-05-12 16:57 ` [PATCH 01/23] nptl: Move __nptl_initial_report_events into ld.so/startup code Florian Weimer
2021-05-13 17:51   ` Adhemerval Zanella
2021-05-17  8:06     ` Florian Weimer
2021-05-18 17:28       ` Adhemerval Zanella
2021-05-12 16:57 ` [PATCH 02/23] nptl: Move __nptl_create_event, __nptl_death_event into libc Florian Weimer
2021-05-13 18:04   ` Adhemerval Zanella
2021-05-12 16:57 ` [PATCH 03/23] elf: Partially initialize ld.so after static dlopen (bug 20802) Florian Weimer
2021-05-13 19:35   ` Adhemerval Zanella
2021-05-13 20:09     ` Florian Weimer
2021-05-13 20:11       ` Adhemerval Zanella
2021-05-13 20:44         ` Florian Weimer
2021-05-12 16:57 ` [PATCH 04/23] aarch64: Remove _dl_var_init Florian Weimer
2021-05-13 19:36   ` Adhemerval Zanella
2021-05-12 16:57 ` [PATCH 05/23] arc: " Florian Weimer
2021-05-13 19:36   ` Adhemerval Zanella
2021-05-12 16:57 ` [PATCH 06/23] ia64: " Florian Weimer
2021-05-13 19:37   ` Adhemerval Zanella
2021-05-12 16:57 ` [PATCH 07/23] m68k: " Florian Weimer
2021-05-13 19:37   ` Adhemerval Zanella
2021-05-12 16:57 ` [PATCH 08/23] mips: " Florian Weimer
2021-05-13 19:37   ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 09/23] powerpc: " Florian Weimer
2021-05-13 19:38   ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 10/23] elf: Remove DL_STATIC_INIT Florian Weimer
2021-05-13 19:38   ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 11/23] elf: Move static TLS size and alignment into _rtld_global_ro Florian Weimer
2021-05-13 19:45   ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 12/23] nptl: Introduce __nptl_deferred_init Florian Weimer
2021-05-13 20:20   ` Adhemerval Zanella
2021-05-13 20:51     ` Florian Weimer
2021-05-14 11:57       ` Adhemerval Zanella
2021-05-14 12:22         ` Florian Weimer
2021-05-14 13:29           ` Adhemerval Zanella
2021-05-14 19:16             ` Carlos O'Donell
2021-05-14 19:27               ` Florian Weimer
2021-05-15  2:02                 ` Carlos O'Donell
2021-05-18 17:29                   ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 13/23] nptl: Eliminate the __static_tls_size, __static_tls_align_m1 variables Florian Weimer
2021-05-14 12:40   ` Adhemerval Zanella
2021-05-17  8:14     ` Florian Weimer
2021-05-18 17:33       ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 14/23] nptl: Move pthread_getattr_default_np into libc Florian Weimer
2021-05-14 14:00   ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 15/23] nptl: Remove unused nptl/pthread_getcpuclockid.c implementation Florian Weimer
2021-05-13 20:22   ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 16/23] Linux: Move implementation of pthread_getcpuclockid to nptl directory Florian Weimer
2021-05-13 20:23   ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 17/23] nptl: Move pthread_getcpuclockid into libc Florian Weimer
2021-05-14 14:05   ` Adhemerval Zanella
2021-05-12 16:58 ` [PATCH 18/23] nptl: Move pthread_getname_np " Florian Weimer
2021-05-14 14:44   ` Adhemerval Zanella
2021-05-12 16:59 ` [PATCH 19/23] nptl: Move pthread_setaffinity_np " Florian Weimer
2021-05-14 14:45   ` Adhemerval Zanella
2021-05-12 16:59 ` [PATCH 20/23] nptl: Move pthread_setname_np " Florian Weimer
2021-05-14 14:46   ` Adhemerval Zanella
2021-05-12 16:59 ` [PATCH 21/23] nptl: Move pthread_setschedprio " Florian Weimer
2021-05-14 14:47   ` Adhemerval Zanella
2021-05-12 16:59 ` [PATCH 22/23] nptl: Move pthread_sigqueue " Florian Weimer
2021-05-14 14:48   ` Adhemerval Zanella
2021-05-12 16:59 ` Florian Weimer [this message]
2021-05-14 14:50   ` [PATCH 23/23] nptl: Move semi-public __pthread_get_minstack symbol " Adhemerval Zanella
2021-05-17  9:12 ` [PATCH 00/23] nptl: Move almost all remaining functions " Florian Weimer

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=a8d79a3d86ce38fea916a49e0ff3f3208f68a2bf.1620838412.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).