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 3/8] nptl: Move semi-public __pthread_get_minstack symbol into libc
Date: Fri, 21 May 2021 14:45:17 +0200	[thread overview]
Message-ID: <59e88ba6b731fb4fb20067fc0e91e71866f48990.1621600831.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1621600831.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



  parent reply	other threads:[~2021-05-21 12:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 12:45 [PATCH v2 0/8] nptl: Complete libpthread move Florian Weimer
2021-05-21 12:45 ` [PATCH 1/8] nptl: Perform signal initialization upon pthread_create Florian Weimer
2021-05-21 20:03   ` Adhemerval Zanella
2021-05-21 20:15     ` Florian Weimer
2021-05-21 20:23       ` Adhemerval Zanella
2021-05-21 12:45 ` [PATCH 2/8] nptl: Eliminate the __static_tls_size, __static_tls_align_m1 variables Florian Weimer
2021-05-21 12:45 ` Florian Weimer [this message]
2021-05-21 12:45 ` [PATCH v2 4/8] elf: Use custom NODELETE DSO for tst-dlopenfail, tst-dlopenfail-2 Florian Weimer
2021-05-21 20:11   ` Adhemerval Zanella
2021-05-21 12:45 ` [PATCH 5/8] nptl: Move pthread_create, thrd_create into libc Florian Weimer
2021-05-21 12:46 ` [PATCH 6/8] nptl: Remove remaining code from libpthread Florian Weimer
2021-05-21 12:46 ` [PATCH 7/8] nptl: Do not install libpthread.so and do not link tests with it Florian Weimer
2021-05-24 17:14   ` Adhemerval Zanella
2021-05-21 12:46 ` [PATCH 8/8] Linux: Remove remaining references to $(shared-thread-library) Florian Weimer
2021-05-24 18:27   ` Adhemerval Zanella

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=59e88ba6b731fb4fb20067fc0e91e71866f48990.1621600831.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).