public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] nptl: Complete libpthread move
@ 2021-05-21 12:45 Florian Weimer
  2021-05-21 12:45 ` [PATCH 1/8] nptl: Perform signal initialization upon pthread_create Florian Weimer
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 12:45 UTC (permalink / raw)
  To: libc-alpha

This series supersedes “nptl: Complete libpthread removal”.  The main
difference is its ending: libpthread.so.0 stays around as a separate
object.  An empty libpthread.a file keeps -lpthread working.

Several patches have already been reviewed.

Tested on i686-linux-gnu and x86_64-linux-gnu.  Built with
build-many-glibcs.py.

Thanks,
Florian

Florian Weimer (8):
  nptl: Perform signal initialization upon pthread_create
  nptl: Eliminate the __static_tls_size, __static_tls_align_m1 variables
  nptl: Move semi-public __pthread_get_minstack symbol into libc
  elf: Use custom NODELETE DSO for tst-dlopenfail, tst-dlopenfail-2
  nptl: Move pthread_create, thrd_create into libc
  nptl: Remove remaining code from libpthread
  nptl: Do not install libpthread.so and do not link tests with it
  Linux: Remove remaining references to $(shared-thread-library)

 elf/Makefile                                  |  11 +-
 elf/dl-tls.c                                  |   5 +-
 elf/tst-dlopenfail-2.c                        |   5 +-
 elf/tst-dlopenfail.c                          |  46 ++---
 elf/tst-dlopenfailmod2.c                      |   6 +-
 .../version.c => elf/tst-dlopenfailnodelmod.c |  28 +--
 include/libc-internal.h                       |   6 +-
 nptl/Makefile                                 |  95 ++-------
 nptl/Versions                                 |  33 ++--
 nptl/allocatestack.c                          |  25 +--
 nptl/libpthread-compat.c                      |  34 ++--
 nptl/nptl-init.c                              | 180 ------------------
 nptl/nptl-stack.c                             |  17 ++
 nptl/nptl-stack.h                             |  11 +-
 nptl/pt-crti.S                                |  50 -----
 nptl/pt-interp.c                              |   1 -
 nptl/pthreadP.h                               |  18 +-
 nptl/pthread_cancel.c                         |  88 ++++++++-
 nptl/pthread_create.c                         |  60 +++++-
 nptl/pthread_getattr_default_np.c             |   6 +-
 nptl_db/Makefile                              |   2 +-
 nptl_db/structs.def                           |  10 +-
 sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c       |   1 -
 sysdeps/arm/nptl/Makefile                     |   3 -
 sysdeps/ia64/nptl/Makefile                    |   5 -
 sysdeps/mips/Makefile                         |   7 -
 sysdeps/mips/nptl/Makefile                    |   5 -
 sysdeps/mips/nptl/nptl-sysdep.S               |   2 -
 sysdeps/nptl/Makeconfig                       |   8 +-
 sysdeps/nptl/Makefile                         |   4 -
 sysdeps/nptl/pthread_early_init.h             |  28 +++
 sysdeps/nptl/thrd_create.c                    |   2 -
 sysdeps/pthread/Makefile                      |   3 +-
 sysdeps/pthread/thrd_create.c                 |  11 +-
 sysdeps/riscv/nptl/Makefile                   |   5 -
 sysdeps/riscv/nptl/nptl-sysdep.S              |   2 -
 sysdeps/s390/nptl/Makefile                    |   5 -
 sysdeps/sparc/Makefile                        |   4 -
 sysdeps/sparc/nptl/Makefile                   |   5 -
 sysdeps/unix/sysv/linux/Makefile              |   6 -
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   4 +
 .../sysv/linux/aarch64/libpthread.abilist     |   5 +-
 sysdeps/unix/sysv/linux/alpha/Makefile        |   6 -
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |   5 +
 .../unix/sysv/linux/alpha/libpthread.abilist  |   7 +-
 sysdeps/unix/sysv/linux/arc/libc.abilist      |   4 +
 .../unix/sysv/linux/arc/libpthread.abilist    |   4 +-
 sysdeps/unix/sysv/linux/arm/Makefile          |   5 -
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |   4 +
 .../unix/sysv/linux/arm/be/libpthread.abilist |   4 +-
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   4 +
 .../unix/sysv/linux/arm/le/libpthread.abilist |   4 +-
 sysdeps/unix/sysv/linux/csky/libc.abilist     |   4 +
 .../unix/sysv/linux/csky/libpthread.abilist   |   4 +-
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |   4 +
 .../unix/sysv/linux/hppa/libpthread.abilist   |   5 +-
 sysdeps/unix/sysv/linux/i386/Makefile         |  12 --
 sysdeps/unix/sysv/linux/i386/libc.abilist     |   5 +
 .../unix/sysv/linux/i386/libpthread.abilist   |   7 +-
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |   4 +
 .../unix/sysv/linux/ia64/libpthread.abilist   |   5 +-
 .../sysv/linux/m68k/coldfire/libc.abilist     |   4 +
 .../linux/m68k/coldfire/libpthread.abilist    |   4 +-
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   5 +
 .../sysv/linux/m68k/m680x0/libpthread.abilist |   7 +-
 sysdeps/unix/sysv/linux/microblaze/Makefile   |   6 -
 .../sysv/linux/microblaze/be/libc.abilist     |   4 +
 .../linux/microblaze/be/libpthread.abilist    |   5 +-
 .../sysv/linux/microblaze/le/libc.abilist     |   4 +
 .../linux/microblaze/le/libpthread.abilist    |   5 +-
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |   5 +
 .../sysv/linux/mips/mips32/libpthread.abilist |   7 +-
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |   5 +
 .../sysv/linux/mips/mips64/libpthread.abilist |   7 +-
 .../sysv/linux/mips/mips64/n32/libc.abilist   |   5 +
 .../sysv/linux/mips/mips64/n64/libc.abilist   |   5 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |   4 +
 .../unix/sysv/linux/nios2/libpthread.abilist  |   5 +-
 sysdeps/unix/sysv/linux/powerpc/Makefile      |   5 -
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |   5 +
 .../powerpc/powerpc32/libpthread.abilist      |   7 +-
 .../powerpc/powerpc32/nofpu/libc.abilist      |   5 +
 .../linux/powerpc/powerpc64/be/libc.abilist   |   4 +
 .../powerpc/powerpc64/be/libpthread.abilist   |   5 +-
 .../linux/powerpc/powerpc64/le/libc.abilist   |   4 +
 .../powerpc/powerpc64/le/libpthread.abilist   |   5 +-
 .../unix/sysv/linux/riscv/rv32/libc.abilist   |   4 +
 .../sysv/linux/riscv/rv32/libpthread.abilist  |   4 +-
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |   4 +
 .../sysv/linux/riscv/rv64/libpthread.abilist  |   5 +-
 .../unix/sysv/linux/s390/s390-32/libc.abilist |   5 +
 .../linux/s390/s390-32/libpthread.abilist     |   7 +-
 .../unix/sysv/linux/s390/s390-64/libc.abilist |   4 +
 .../linux/s390/s390-64/libpthread.abilist     |   5 +-
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |   4 +
 .../unix/sysv/linux/sh/be/libpthread.abilist  |   5 +-
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   4 +
 .../unix/sysv/linux/sh/le/libpthread.abilist  |   5 +-
 sysdeps/unix/sysv/linux/sparc/Makefile        |   6 -
 .../sysv/linux/sparc/sparc32/libc.abilist     |   5 +
 .../linux/sparc/sparc32/libpthread.abilist    |   7 +-
 .../sysv/linux/sparc/sparc64/libc.abilist     |   4 +
 .../linux/sparc/sparc64/libpthread.abilist    |   5 +-
 .../unix/sysv/linux/x86_64/64/libc.abilist    |   4 +
 .../sysv/linux/x86_64/64/libpthread.abilist   |   5 +-
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |   4 +
 .../sysv/linux/x86_64/x32/libpthread.abilist  |   5 +-
 107 files changed, 535 insertions(+), 642 deletions(-)
 rename nptl/version.c => elf/tst-dlopenfailnodelmod.c (51%)
 delete mode 100644 nptl/nptl-init.c
 delete mode 100644 nptl/pt-crti.S
 delete mode 100644 nptl/pt-interp.c
 delete mode 100644 sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c
 delete mode 100644 sysdeps/mips/nptl/nptl-sysdep.S
 delete mode 100644 sysdeps/nptl/thrd_create.c
 delete mode 100644 sysdeps/riscv/nptl/nptl-sysdep.S

-- 
2.31.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/8] nptl: Perform signal initialization upon pthread_create
  2021-05-21 12:45 [PATCH v2 0/8] nptl: Complete libpthread move Florian Weimer
@ 2021-05-21 12:45 ` Florian Weimer
  2021-05-21 20:03   ` Adhemerval Zanella
  2021-05-21 12:45 ` [PATCH 2/8] nptl: Eliminate the __static_tls_size, __static_tls_align_m1 variables Florian Weimer
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 12:45 UTC (permalink / raw)
  To: libc-alpha

Install signal handlers and unblock signals before pthread_create
creates the first thread.

create_thread in sysdeps/unix/sysv/linux/createthread.c can send
SIGCANCEL to the current thread, so the SIGCANCEL handler is currently
needed even if pthread_cancel is never called.  (The way timer_create
uses SIGCANCEL does not need a signal handler; both SIG_DFL and SIG_IGN
dispositions should work.)
---
 nptl/Versions         |  5 ++-
 nptl/nptl-init.c      | 75 ------------------------------------
 nptl/pthreadP.h       |  6 +++
 nptl/pthread_cancel.c | 88 ++++++++++++++++++++++++++++++++++++++-----
 nptl/pthread_create.c | 45 +++++++++++++++++++++-
 5 files changed, 131 insertions(+), 88 deletions(-)

diff --git a/nptl/Versions b/nptl/Versions
index e7883cbb49..d96b830d05 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -367,8 +367,6 @@ libc {
     tss_set;
   }
   GLIBC_PRIVATE {
-     __nptl_create_event;
-     __nptl_death_event;
     __default_pthread_attr;
     __default_pthread_attr_lock;
     __futex_abstimed_wait64;
@@ -386,11 +384,14 @@ libc {
     __lll_trylock_elision;
     __lll_unlock_elision;
     __mutex_aconf;
+    __nptl_create_event;
     __nptl_deallocate_stack;
     __nptl_deallocate_tsd;
+    __nptl_death_event;
     __nptl_free_tcb;
     __nptl_nthreads;
     __nptl_setxid_sighandler;
+    __nptl_sigcancel_handler;
     __nptl_stack_list_add;
     __nptl_stack_list_del;
     __pthread_attr_copy;
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index f4b86fbfaf..bc4831ac89 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -44,84 +44,9 @@ size_t __static_tls_align_m1;
 /* Version of the library, used in libthread_db to detect mismatches.  */
 static const char nptl_version[] __attribute_used__ = VERSION;
 
-/* For asynchronous cancellation we use a signal.  This is the handler.  */
-static void
-sigcancel_handler (int sig, siginfo_t *si, void *ctx)
-{
-  /* Safety check.  It would be possible to call this function for
-     other signals and send a signal from another process.  This is not
-     correct and might even be a security problem.  Try to catch as
-     many incorrect invocations as possible.  */
-  if (sig != SIGCANCEL
-      || si->si_pid != __getpid()
-      || si->si_code != SI_TKILL)
-    return;
-
-  struct pthread *self = THREAD_SELF;
-
-  int oldval = THREAD_GETMEM (self, cancelhandling);
-  while (1)
-    {
-      /* We are canceled now.  When canceled by another thread this flag
-	 is already set but if the signal is directly send (internally or
-	 from another process) is has to be done here.  */
-      int newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
-
-      if (oldval == newval || (oldval & EXITING_BITMASK) != 0)
-	/* Already canceled or exiting.  */
-	break;
-
-      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
-					      oldval);
-      if (curval == oldval)
-	{
-	  /* Set the return value.  */
-	  THREAD_SETMEM (self, result, PTHREAD_CANCELED);
-
-	  /* Make sure asynchronous cancellation is still enabled.  */
-	  if ((newval & CANCELTYPE_BITMASK) != 0)
-	    /* Run the registered destructors and terminate the thread.  */
-	    __do_cancel ();
-
-	  break;
-	}
-
-      oldval = curval;
-    }
-}
-
-
-/* When using __thread for this, we do it in libc so as not
-   to give libpthread its own TLS segment just for this.  */
-extern void **__libc_dl_error_tsd (void) __attribute__ ((const));
-
-
 void
 __pthread_initialize_minimal_internal (void)
 {
-  struct sigaction sa;
-  __sigemptyset (&sa.sa_mask);
-
-  /* Install the cancellation signal handler.  If for some reason we
-     cannot install the handler we do not abort.  Maybe we should, but
-     it is only asynchronous cancellation which is affected.  */
-  sa.sa_sigaction = sigcancel_handler;
-  sa.sa_flags = SA_SIGINFO;
-  (void) __libc_sigaction (SIGCANCEL, &sa, NULL);
-
-  /* Install the handle to change the threads' uid/gid.  */
-  sa.sa_sigaction = __nptl_setxid_sighandler;
-  sa.sa_flags = SA_SIGINFO | SA_RESTART;
-  (void) __libc_sigaction (SIGSETXID, &sa, NULL);
-
-  /* The parent process might have left the signals blocked.  Just in
-     case, unblock it.  We reuse the signal mask in the sigaction
-     structure.  It is already cleared.  */
-  __sigaddset (&sa.sa_mask, SIGCANCEL);
-  __sigaddset (&sa.sa_mask, SIGSETXID);
-  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sa.sa_mask,
-			 NULL, __NSIG_BYTES);
-
   /* Get the size of the static and alignment requirements for the TLS
      block.  */
   size_t static_tls_align;
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index f93806e540..497c2ad3d9 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -571,6 +571,12 @@ libc_hidden_proto (__pthread_attr_setsigmask_internal)
 extern __typeof (pthread_attr_getsigmask_np) __pthread_attr_getsigmask_np;
 libc_hidden_proto (__pthread_attr_getsigmask_np)
 
+/* The cancellation signal handler defined alongside with
+   pthread_cancel.  This is included in statically linked binaries
+   only if pthread_cancel is linked in.  */
+void __nptl_sigcancel_handler (int sig, siginfo_t *si, void *ctx);
+libc_hidden_proto (__nptl_sigcancel_handler)
+
 /* Special versions which use non-exported functions.  */
 extern void __pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer,
 				    void (*routine) (void *), void *arg);
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index e4ad602900..802c691874 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -26,6 +26,63 @@
 #include <unwind-link.h>
 #include <stdio.h>
 #include <gnu/lib-names.h>
+#include <sys/single_threaded.h>
+
+/* For asynchronous cancellation we use a signal.  This is the core
+   logic of the signal handler.  */
+static void
+sigcancel_handler (void)
+{
+  struct pthread *self = THREAD_SELF;
+
+  int oldval = THREAD_GETMEM (self, cancelhandling);
+  while (1)
+    {
+      /* We are canceled now.  When canceled by another thread this flag
+	 is already set but if the signal is directly send (internally or
+	 from another process) is has to be done here.  */
+      int newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
+
+      if (oldval == newval || (oldval & EXITING_BITMASK) != 0)
+	/* Already canceled or exiting.  */
+	break;
+
+      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
+					      oldval);
+      if (curval == oldval)
+	{
+	  /* Set the return value.  */
+	  THREAD_SETMEM (self, result, PTHREAD_CANCELED);
+
+	  /* Make sure asynchronous cancellation is still enabled.  */
+	  if ((newval & CANCELTYPE_BITMASK) != 0)
+	    /* Run the registered destructors and terminate the thread.  */
+	    __do_cancel ();
+
+	  break;
+	}
+
+      oldval = curval;
+    }
+}
+
+/* This is the actually installed SIGCANCEL handler.  It adds some
+   safety checks before performing the cancellation.  */
+void
+__nptl_sigcancel_handler (int sig, siginfo_t *si, void *ctx)
+{
+  /* Safety check.  It would be possible to call this function for
+     other signals and send a signal from another process.  This is not
+     correct and might even be a security problem.  Try to catch as
+     many incorrect invocations as possible.  */
+  if (sig != SIGCANCEL
+      || si->si_pid != __getpid()
+      || si->si_code != SI_TKILL)
+    return;
+
+  sigcancel_handler ();
+}
+libc_hidden_def (__nptl_sigcancel_handler)
 
 int
 __pthread_cancel (pthread_t th)
@@ -72,14 +129,23 @@ __pthread_cancel (pthread_t th)
 						    oldval))
 	    goto again;
 
-	  /* The cancellation handler will take care of marking the
-	     thread as canceled.  */
-	  pid_t pid = __getpid ();
-
-	  int val = INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid,
-					   SIGCANCEL);
-	  if (INTERNAL_SYSCALL_ERROR_P (val))
-	    result = INTERNAL_SYSCALL_ERRNO (val);
+	  if (pd == THREAD_SELF)
+	    /* This is not merely an optimization: An application may
+	       call pthread_cancel (pthread_self ()) without calling
+	       pthread_create, so the signal handler may not have been
+	       set up for a self-cancel.  */
+	    sigcancel_handler ();
+	  else
+	    {
+	      /* The cancellation handler will take care of marking the
+		 thread as canceled.  */
+	      pid_t pid = __getpid ();
+
+	      int val = INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid,
+					       SIGCANCEL);
+	      if (INTERNAL_SYSCALL_ERROR_P (val))
+		result = INTERNAL_SYSCALL_ERRNO (val);
+	    }
 
 	  break;
 	}
@@ -106,4 +172,8 @@ versioned_symbol (libc, __pthread_cancel, pthread_cancel, GLIBC_2_34);
 compat_symbol (libpthread, __pthread_cancel, pthread_cancel, GLIBC_2_0);
 #endif
 
-PTHREAD_STATIC_FN_REQUIRE (__pthread_create)
+/* Ensure that the unwinder is always linked in (the __pthread_unwind
+   reference from __do_cancel is weak).  Use ___pthread_unwind_next
+   (three underscores) to produce a strong reference to the same
+   file.  */
+PTHREAD_STATIC_FN_REQUIRE (___pthread_unwind_next)
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 770656453d..772b5efcc6 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -56,6 +56,43 @@ static struct rtld_global *__nptl_rtld_global __attribute_used__
   = &_rtld_global;
 #endif
 
+/* This performs the initialization necessary when going from
+   single-threaded to multi-threaded mode for the first time.  */
+static void
+late_init (void)
+{
+  struct sigaction sa;
+  __sigemptyset (&sa.sa_mask);
+
+  /* Install the cancellation signal handler (in static builds only if
+     pthread_cancel has been linked in).  If for some reason we cannot
+     install the handler we do not abort.  Maybe we should, but it is
+     only asynchronous cancellation which is affected.  */
+#ifndef SHARED
+  extern __typeof (__nptl_sigcancel_handler) __nptl_sigcancel_handler
+    __attribute__ ((weak));
+  if (__nptl_sigcancel_handler != NULL)
+#endif
+    {
+      sa.sa_sigaction = __nptl_sigcancel_handler;
+      sa.sa_flags = SA_SIGINFO;
+      (void) __libc_sigaction (SIGCANCEL, &sa, NULL);
+    }
+
+  /* Install the handle to change the threads' uid/gid.  */
+  sa.sa_sigaction = __nptl_setxid_sighandler;
+  sa.sa_flags = SA_SIGINFO | SA_RESTART;
+  (void) __libc_sigaction (SIGSETXID, &sa, NULL);
+
+  /* The parent process might have left the signals blocked.  Just in
+     case, unblock it.  We reuse the signal mask in the sigaction
+     structure.  It is already cleared.  */
+  __sigaddset (&sa.sa_mask, SIGCANCEL);
+  __sigaddset (&sa.sa_mask, SIGSETXID);
+  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sa.sa_mask,
+			 NULL, __NSIG_BYTES);
+}
+
 /* Code to allocate and deallocate a stack.  */
 #include "allocatestack.c"
 
@@ -459,9 +496,13 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
 {
   STACK_VARIABLES;
 
-  /* Avoid a data race in the multi-threaded case.  */
+  /* Avoid a data race in the multi-threaded case, and call the
+     deferred initialization only once.  */
   if (__libc_single_threaded)
-    __libc_single_threaded = 0;
+    {
+      late_init ();
+      __libc_single_threaded = 0;
+    }
 
   const struct pthread_attr *iattr = (struct pthread_attr *) attr;
   union pthread_attr_transparent default_attr;
-- 
2.31.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/8] nptl: Eliminate the __static_tls_size, __static_tls_align_m1 variables
  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 12:45 ` Florian Weimer
  2021-05-21 12:45 ` [PATCH 3/8] nptl: Move semi-public __pthread_get_minstack symbol into libc Florian Weimer
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 12:45 UTC (permalink / raw)
  To: libc-alpha

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>
---
 elf/dl-tls.c                      |  5 ++--
 nptl/allocatestack.c              | 25 +++++++++--------
 nptl/nptl-init.c                  | 46 ++-----------------------------
 nptl/nptl-stack.h                 | 11 +++++++-
 nptl/pthreadP.h                   |  4 ---
 sysdeps/nptl/pthread_early_init.h | 28 +++++++++++++++++++
 6 files changed, 58 insertions(+), 61 deletions(-)

diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 91031c2b72..e531ec5913 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -386,8 +386,9 @@ allocate_dtv (void *result)
   return result;
 }
 
-
-/* Get size and alignment requirements of the static TLS block.  */
+/* Get size and alignment requirements of the static TLS block.  This
+   function is no longer used by glibc itself, but the GCC sanitizers
+   use it despite the GLIBC_PRIVATE status.  */
 void
 _dl_get_tls_static_info (size_t *sizep, size_t *alignp)
 {
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index c0a5c4d96d..dc81a2ca73 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -254,6 +254,8 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
   struct pthread *pd;
   size_t size;
   size_t pagesize_m1 = __getpagesize () - 1;
+  size_t tls_static_size_for_stack = __nptl_tls_static_size_for_stack ();
+  size_t tls_static_align_m1 = GLRO (dl_tls_static_align) - 1;
 
   assert (powerof2 (pagesize_m1 + 1));
   assert (TCB_ALIGNMENT >= STACK_ALIGN);
@@ -284,17 +286,18 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
       /* If the user also specified the size of the stack make sure it
 	 is large enough.  */
       if (attr->stacksize != 0
-	  && attr->stacksize < (__static_tls_size + MINIMAL_REST_STACK))
+	  && attr->stacksize < (tls_static_size_for_stack
+				+ MINIMAL_REST_STACK))
 	return EINVAL;
 
       /* Adjust stack size for alignment of the TLS block.  */
 #if TLS_TCB_AT_TP
       adj = ((uintptr_t) stackaddr - TLS_TCB_SIZE)
-	    & __static_tls_align_m1;
+	    & tls_static_align_m1;
       assert (size > adj + TLS_TCB_SIZE);
 #elif TLS_DTV_AT_TP
-      adj = ((uintptr_t) stackaddr - __static_tls_size)
-	    & __static_tls_align_m1;
+      adj = ((uintptr_t) stackaddr - tls_static_size_for_stack)
+	    & tls_static_align_m1;
       assert (size > adj);
 #endif
 
@@ -307,7 +310,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 			       - TLS_TCB_SIZE - adj);
 #elif TLS_DTV_AT_TP
       pd = (struct pthread *) (((uintptr_t) stackaddr
-				- __static_tls_size - adj)
+				- tls_static_size_for_stack - adj)
 			       - TLS_PRE_TCB_SIZE);
 #endif
 
@@ -366,7 +369,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 			| ((GL(dl_stack_flags) & PF_X) ? PROT_EXEC : 0));
 
       /* Adjust the stack size for alignment.  */
-      size &= ~__static_tls_align_m1;
+      size &= ~tls_static_align_m1;
       assert (size != 0);
 
       /* Make sure the size of the stack is enough for the guard and
@@ -385,7 +388,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 	/* Arithmetic overflow.  */
 	return EINVAL;
       size += guardsize;
-      if (__builtin_expect (size < ((guardsize + __static_tls_size
+      if (__builtin_expect (size < ((guardsize + tls_static_size_for_stack
 				     + MINIMAL_REST_STACK + pagesize_m1)
 				    & ~pagesize_m1),
 			    0))
@@ -414,11 +417,11 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 #if TLS_TCB_AT_TP
 	  pd = (struct pthread *) ((((uintptr_t) mem + size)
 				    - TLS_TCB_SIZE)
-				   & ~__static_tls_align_m1);
+				   & ~tls_static_align_m1);
 #elif TLS_DTV_AT_TP
 	  pd = (struct pthread *) ((((uintptr_t) mem + size
-				    - __static_tls_size)
-				    & ~__static_tls_align_m1)
+				    - tls_static_size_for_stack)
+				    & ~tls_static_align_m1)
 				   - TLS_PRE_TCB_SIZE);
 #endif
 
@@ -602,7 +605,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 
 # if TLS_TCB_AT_TP
   /* The stack begins before the TCB and the static TLS block.  */
-  stacktop = ((char *) (pd + 1) - __static_tls_size);
+  stacktop = ((char *) (pd + 1) - tls_static_size_for_stack);
 # elif TLS_DTV_AT_TP
   stacktop = (char *) (pd - 1);
 # endif
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index bc4831ac89..732e580355 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -36,10 +36,7 @@
 #include <kernel-features.h>
 #include <libc-pointer-arith.h>
 #include <pthread_mutex_conf.h>
-
-/* Size and alignment of static TLS block.  */
-size_t __static_tls_size;
-size_t __static_tls_align_m1;
+#include <nptl-stack.h>
 
 /* Version of the library, used in libthread_db to detect mismatches.  */
 static const char nptl_version[] __attribute_used__ = VERSION;
@@ -47,44 +44,6 @@ static const char nptl_version[] __attribute_used__ = VERSION;
 void
 __pthread_initialize_minimal_internal (void)
 {
-  /* Get the size of the static and alignment requirements for the TLS
-     block.  */
-  size_t static_tls_align;
-  _dl_get_tls_static_info (&__static_tls_size, &static_tls_align);
-
-  /* Make sure the size takes all the alignments into account.  */
-  if (STACK_ALIGN > static_tls_align)
-    static_tls_align = STACK_ALIGN;
-  __static_tls_align_m1 = static_tls_align - 1;
-
-  __static_tls_size = roundup (__static_tls_size, static_tls_align);
-
-  /* Determine the default allowed stack size.  This is the size used
-     in case the user does not specify one.  */
-  struct rlimit limit;
-  if (__getrlimit (RLIMIT_STACK, &limit) != 0
-      || limit.rlim_cur == RLIM_INFINITY)
-    /* The system limit is not usable.  Use an architecture-specific
-       default.  */
-    limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
-  else if (limit.rlim_cur < PTHREAD_STACK_MIN)
-    /* The system limit is unusably small.
-       Use the minimal size acceptable.  */
-    limit.rlim_cur = PTHREAD_STACK_MIN;
-
-  /* Make sure it meets the minimum size that allocate_stack
-     (allocatestack.c) will demand, which depends on the page size.  */
-  const uintptr_t pagesz = GLRO(dl_pagesize);
-  const size_t minstack = pagesz + __static_tls_size + MINIMAL_REST_STACK;
-  if (limit.rlim_cur < minstack)
-    limit.rlim_cur = minstack;
-
-  /* Round the resource limit up to page size.  */
-  limit.rlim_cur = ALIGN_UP (limit.rlim_cur, pagesz);
-  lll_lock (__default_pthread_attr_lock, LLL_PRIVATE);
-  __default_pthread_attr.internal.stacksize = limit.rlim_cur;
-  __default_pthread_attr.internal.guardsize = GLRO (dl_pagesize);
-  lll_unlock (__default_pthread_attr_lock, LLL_PRIVATE);
 }
 strong_alias (__pthread_initialize_minimal_internal,
 	      __pthread_initialize_minimal)
@@ -101,5 +60,6 @@ strong_alias (__pthread_initialize_minimal_internal,
 size_t
 __pthread_get_minstack (const pthread_attr_t *attr)
 {
-  return GLRO(dl_pagesize) + __static_tls_size + PTHREAD_STACK_MIN;
+  return (GLRO(dl_pagesize) + __nptl_tls_static_size_for_stack ()
+	  + PTHREAD_STACK_MIN);
 }
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 */
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 497c2ad3d9..d011a0ec34 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -205,10 +205,6 @@ libc_hidden_proto (__default_pthread_attr_lock)
 /* Called from __libc_freeres to deallocate the default attribute.  */
 extern void __default_pthread_attr_freeres (void) attribute_hidden;
 
-/* Size and alignment of static TLS block.  */
-extern size_t __static_tls_size attribute_hidden;
-extern size_t __static_tls_align_m1 attribute_hidden;
-
 /* Attribute handling.  */
 extern struct pthread_attr *__attr_list attribute_hidden;
 extern int __attr_list_lock attribute_hidden;
diff --git a/sysdeps/nptl/pthread_early_init.h b/sysdeps/nptl/pthread_early_init.h
index 2d15303dd9..5b49ce39c2 100644
--- a/sysdeps/nptl/pthread_early_init.h
+++ b/sysdeps/nptl/pthread_early_init.h
@@ -19,12 +19,40 @@
 #ifndef _PTHREAD_EARLY_INIT_H
 #define _PTHREAD_EARLY_INIT_H 1
 
+#include <nptl/nptl-stack.h>
 #include <nptl/pthreadP.h>
 #include <pthread_mutex_conf.h>
+#include <sys/resource.h>
 
 static inline void
 __pthread_early_init (void)
 {
+  /* Determine the default allowed stack size.  This is the size used
+     in case the user does not specify one.  */
+  struct rlimit limit;
+  if (__getrlimit (RLIMIT_STACK, &limit) != 0
+      || limit.rlim_cur == RLIM_INFINITY)
+    /* The system limit is not usable.  Use an architecture-specific
+       default.  */
+    limit.rlim_cur = ARCH_STACK_DEFAULT_SIZE;
+  else if (limit.rlim_cur < PTHREAD_STACK_MIN)
+    /* The system limit is unusably small.
+       Use the minimal size acceptable.  */
+    limit.rlim_cur = PTHREAD_STACK_MIN;
+
+  /* Make sure it meets the minimum size that allocate_stack
+     (allocatestack.c) will demand, which depends on the page size.  */
+  const uintptr_t pagesz = GLRO(dl_pagesize);
+  const size_t minstack = (pagesz + __nptl_tls_static_size_for_stack ()
+                           + MINIMAL_REST_STACK);
+  if (limit.rlim_cur < minstack)
+    limit.rlim_cur = minstack;
+
+  /* Round the resource limit up to page size.  */
+  limit.rlim_cur = ALIGN_UP (limit.rlim_cur, pagesz);
+  __default_pthread_attr.internal.stacksize = limit.rlim_cur;
+  __default_pthread_attr.internal.guardsize = GLRO (dl_pagesize);
+
 #if HAVE_TUNABLES
   __pthread_tunables_init ();
 #endif
-- 
2.31.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 3/8] nptl: Move semi-public __pthread_get_minstack symbol into libc
  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 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
  2021-05-21 12:45 ` [PATCH v2 4/8] elf: Use custom NODELETE DSO for tst-dlopenfail, tst-dlopenfail-2 Florian Weimer
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 12:45 UTC (permalink / raw)
  To: libc-alpha

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



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 4/8] elf: Use custom NODELETE DSO for tst-dlopenfail, tst-dlopenfail-2
  2021-05-21 12:45 [PATCH v2 0/8] nptl: Complete libpthread move Florian Weimer
                   ` (2 preceding siblings ...)
  2021-05-21 12:45 ` [PATCH 3/8] nptl: Move semi-public __pthread_get_minstack symbol into libc Florian Weimer
@ 2021-05-21 12:45 ` 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
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 12:45 UTC (permalink / raw)
  To: libc-alpha

Once libpthread is empty and no longer marked NODELETE, it no longer
can be used for testing.
---
v2: Restrict the use of xdlopen/xdlsym, reverting to what was there before.

 elf/Makefile                 | 11 +++++++--
 elf/tst-dlopenfail-2.c       |  5 +---
 elf/tst-dlopenfail.c         | 46 +++++++++++++++---------------------
 elf/tst-dlopenfailmod2.c     |  6 ++---
 elf/tst-dlopenfailnodelmod.c | 29 +++++++++++++++++++++++
 5 files changed, 61 insertions(+), 36 deletions(-)
 create mode 100644 elf/tst-dlopenfailnodelmod.c

diff --git a/elf/Makefile b/elf/Makefile
index 5e809dbfaa..834ec858a8 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -334,7 +334,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
 		tst-auditmanymod7 tst-auditmanymod8 tst-auditmanymod9 \
 		tst-initlazyfailmod tst-finilazyfailmod \
 		tst-dlopenfailmod1 tst-dlopenfaillinkmod tst-dlopenfailmod2 \
-		tst-dlopenfailmod3 tst-ldconfig-ld-mod \
+		tst-dlopenfailmod3 tst-dlopenfailnodelmod tst-ldconfig-ld-mod \
 		tst-filterobj-flt tst-filterobj-aux tst-filterobj-filtee \
 		tst-auditlogmod-1 tst-auditlogmod-2 tst-auditlogmod-3 \
 		tst-single_threaded-mod1 tst-single_threaded-mod2 \
@@ -1733,11 +1733,18 @@ LDFLAGS-tst-dlopenfailmod1.so = -Wl,--no-as-needed
 $(objpfx)tst-dlopenfailmod1.so: \
   $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so
 LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so
-$(objpfx)tst-dlopenfailmod2.so: $(shared-thread-library)
+$(objpfx)tst-dlopenfailmod2.so: $(objpfx)tst-dlopenfailnodelmod.so
 $(objpfx)tst-dlopenfail-2: $(libdl)
 $(objpfx)tst-dlopenfail-2.out: \
   $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so \
   $(objpfx)tst-dlopenfailmod3.so
+# tst-dlopenfailnodelmod.so emulates how libpthread was linked.
+$(objpfx)tst-dlopenfailnodelmod.so: $(libsupport)
+LDFLAGS-tst-dlopenfailnodelmod.so = \
+  -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
+# tst-dlopenfail should export the libsupport symbols, so that
+# tst-dlopenfailnodelmod.so uses them for error reporting.
+LDFLAGS-tst-dlopenfail = -Wl,-E
 
 $(objpfx)tst-dlopen-nodelete-reloc: $(libdl)
 $(objpfx)tst-dlopen-nodelete-reloc.out: \
diff --git a/elf/tst-dlopenfail-2.c b/elf/tst-dlopenfail-2.c
index 50eed81cb0..168c4b2c7f 100644
--- a/elf/tst-dlopenfail-2.c
+++ b/elf/tst-dlopenfail-2.c
@@ -28,10 +28,7 @@
 static int
 do_test (void)
 {
-  /* This test uses libpthread as the canonical NODELETE module.  If
-     libpthread is no longer NODELETE because it has been merged into
-     libc, the test needs to be updated.  */
-  TEST_VERIFY (dlsym (NULL, "pthread_create") == NULL);
+  TEST_VERIFY (dlsym (NULL, "no_delete_mod_function") == NULL);
 
   /* This is expected to fail because of the missing dependency.  */
   puts ("info: attempting to load tst-dlopenfailmod1.so");
diff --git a/elf/tst-dlopenfail.c b/elf/tst-dlopenfail.c
index db2b41f9b5..edf84e8259 100644
--- a/elf/tst-dlopenfail.c
+++ b/elf/tst-dlopenfail.c
@@ -18,7 +18,6 @@
 
 #include <dlfcn.h>
 #include <errno.h>
-#include <gnu/lib-names.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <string.h>
@@ -28,10 +27,7 @@
 static int
 do_test (void)
 {
-  /* This test uses libpthread as the canonical NODELETE module.  If
-     libpthread is no longer NODELETE because it has been merged into
-     libc, the test needs to be updated.  */
-  TEST_VERIFY (dlsym (NULL, "pthread_create") == NULL);
+  TEST_VERIFY (dlsym (NULL, "no_delete_mod_function") == NULL);
 
   /* This is expected to fail because of the missing dependency.  */
   puts ("info: attempting to load tst-dlopenfailmod1.so");
@@ -42,36 +38,32 @@ do_test (void)
                        " cannot open shared object file:"
                        " No such file or directory");
 
-  /* Do not probe for the presence of libpthread at this point because
-     that might trigger relocation if bug 20839 is present, obscuring
-     a subsequent crash.  */
+  /* Do not probe for the presence of the tst-dlopenfailnodelmod.so at
+     this point because that might trigger relocation if bug 20839 is
+     present, obscuring a subsequent crash.  */
 
   /* This is expected to succeed.  */
   puts ("info: loading tst-dlopenfailmod2.so");
   void *handle = xdlopen ("tst-dlopenfailmod2.so", RTLD_NOW);
   xdlclose (handle);
 
-  /* libpthread should remain loaded.  */
-  TEST_VERIFY (dlopen (LIBPTHREAD_SO, RTLD_LAZY | RTLD_NOLOAD) != NULL);
-  TEST_VERIFY (dlsym (NULL, "pthread_create") == NULL);
+  /* The NODELETE module should remain loaded.  */
+  TEST_VERIFY (dlopen ("tst-dlopenfailnodelmod.so", RTLD_LAZY | RTLD_NOLOAD)
+               != NULL);
+  /* But the symbol is not in the global scope.  */
+  TEST_VERIFY (dlsym (NULL, "no_delete_mod_function") == NULL);
 
-  /* We can make libpthread global, and then the symbol should become
-     available.  */
-  TEST_VERIFY (dlopen (LIBPTHREAD_SO, RTLD_LAZY | RTLD_GLOBAL) != NULL);
-  TEST_VERIFY (dlsym (NULL, "pthread_create") != NULL);
+  /* We can make tst-dlopenfailnodelmod.so global, and then the symbol
+     should become available.  */
+  TEST_VERIFY (dlopen ("tst-dlopenfailnodelmod.so", RTLD_LAZY | RTLD_GLOBAL)
+               != NULL);
+  void (*no_delete_mod_function) (void)
+    = dlsym (NULL, "no_delete_mod_function");
+  TEST_VERIFY_EXIT (no_delete_mod_function != NULL);
 
-  /* sem_open is sufficiently complex to depend on relocations.  */
-  void *(*sem_open_ptr) (const char *, int flag, ...)
-    = dlsym (NULL, "sem_open");
-  if (sem_open_ptr == NULL)
-    /* Hurd does not implement sem_open.  */
-    puts ("warning: sem_open not found, further testing not possible");
-  else
-    {
-      errno = 0;
-      TEST_VERIFY (sem_open_ptr ("/", 0) == NULL);
-      TEST_COMPARE (errno, EINVAL);
-    }
+  /* Hopefully, no_delete_mod_function is sufficiently complex to
+     depend on relocations.  */
+  no_delete_mod_function ();
 
   return 0;
 }
diff --git a/elf/tst-dlopenfailmod2.c b/elf/tst-dlopenfailmod2.c
index cd6f9cf56b..ed353f9a3c 100644
--- a/elf/tst-dlopenfailmod2.c
+++ b/elf/tst-dlopenfailmod2.c
@@ -16,11 +16,11 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <pthread.h>
 #include <stdio.h>
 
-/* Force linking against libpthread.  */
-void *pthread_create_reference = pthread_create;
+/* Force linking against tst-dlopenfailnodelmod.so.  */
+void no_delete_mod_function (void);
+void *function_reference = no_delete_mod_function;
 
 static void __attribute__ ((constructor))
 init (void)
diff --git a/elf/tst-dlopenfailnodelmod.c b/elf/tst-dlopenfailnodelmod.c
new file mode 100644
index 0000000000..c4347b7591
--- /dev/null
+++ b/elf/tst-dlopenfailnodelmod.c
@@ -0,0 +1,29 @@
+/* NODELETE module for tst-dlopenfail, tst-dlopenfail-2.
+   Copyright (C) 2021 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <support/check.h>
+
+/* Introduce some relocation dependencies.  */
+const char test_string[] = "test string";
+const char *test_string_ptr = test_string;
+
+void
+no_delete_mod_function (void)
+{
+  TEST_COMPARE_STRING (test_string, test_string_ptr);
+}
-- 
2.31.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 5/8] nptl: Move pthread_create, thrd_create into libc
  2021-05-21 12:45 [PATCH v2 0/8] nptl: Complete libpthread move Florian Weimer
                   ` (3 preceding siblings ...)
  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 12:45 ` Florian Weimer
  2021-05-21 12:46 ` [PATCH 6/8] nptl: Remove remaining code from libpthread Florian Weimer
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 12:45 UTC (permalink / raw)
  To: libc-alpha

The symbols were moved using scripts/move-symbol-to-libc.py.

The libpthread placeholder symbols need some changes because some
symbol versions have gone away completely.  But
__errno_location@@GLIBC_2.0 still exists, so the GLIBC_2.0 version
is still there.

The internal __pthread_create symbol now points to the correct
function, so the sysdeps/nptl/thrd_create.c override is no longer
necessary.

There was an issue how the hidden alias of pthread_getattr_default_np
was defined, so this commit cleans up that aspects and removes the
GLIBC_PRIVATE export altogether.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
---
 include/libc-internal.h                       |  6 ++++-
 nptl/Makefile                                 |  2 +-
 nptl/Versions                                 | 14 +++++++----
 nptl/libpthread-compat.c                      | 24 +++++++++----------
 nptl/pthreadP.h                               |  7 +++---
 nptl/pthread_create.c                         | 11 +++++++--
 nptl/pthread_getattr_default_np.c             |  6 +++--
 nptl_db/Makefile                              |  2 +-
 nptl_db/structs.def                           | 10 ++++----
 sysdeps/nptl/thrd_create.c                    |  2 --
 sysdeps/pthread/Makefile                      |  3 +--
 sysdeps/pthread/thrd_create.c                 | 11 ++++++++-
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |  4 ++++
 .../sysv/linux/aarch64/libpthread.abilist     |  3 +--
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |  5 ++++
 .../unix/sysv/linux/alpha/libpthread.abilist  |  5 ++--
 sysdeps/unix/sysv/linux/arc/libc.abilist      |  4 ++++
 .../unix/sysv/linux/arc/libpthread.abilist    |  2 --
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |  4 ++++
 .../unix/sysv/linux/arm/be/libpthread.abilist |  3 +--
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |  4 ++++
 .../unix/sysv/linux/arm/le/libpthread.abilist |  3 +--
 sysdeps/unix/sysv/linux/csky/libc.abilist     |  4 ++++
 .../unix/sysv/linux/csky/libpthread.abilist   |  2 --
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |  4 ++++
 .../unix/sysv/linux/hppa/libpthread.abilist   |  3 +--
 sysdeps/unix/sysv/linux/i386/libc.abilist     |  5 ++++
 .../unix/sysv/linux/i386/libpthread.abilist   |  5 ++--
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |  4 ++++
 .../unix/sysv/linux/ia64/libpthread.abilist   |  3 +--
 .../sysv/linux/m68k/coldfire/libc.abilist     |  4 ++++
 .../linux/m68k/coldfire/libpthread.abilist    |  3 +--
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  5 ++++
 .../sysv/linux/m68k/m680x0/libpthread.abilist |  5 ++--
 .../sysv/linux/microblaze/be/libc.abilist     |  4 ++++
 .../linux/microblaze/be/libpthread.abilist    |  3 +--
 .../sysv/linux/microblaze/le/libc.abilist     |  4 ++++
 .../linux/microblaze/le/libpthread.abilist    |  3 +--
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |  5 ++++
 .../sysv/linux/mips/mips32/libpthread.abilist |  5 ++--
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |  5 ++++
 .../sysv/linux/mips/mips64/libpthread.abilist |  5 ++--
 .../sysv/linux/mips/mips64/n32/libc.abilist   |  5 ++++
 .../sysv/linux/mips/mips64/n64/libc.abilist   |  5 ++++
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |  4 ++++
 .../unix/sysv/linux/nios2/libpthread.abilist  |  3 +--
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |  5 ++++
 .../powerpc/powerpc32/libpthread.abilist      |  5 ++--
 .../powerpc/powerpc32/nofpu/libc.abilist      |  5 ++++
 .../linux/powerpc/powerpc64/be/libc.abilist   |  4 ++++
 .../powerpc/powerpc64/be/libpthread.abilist   |  3 +--
 .../linux/powerpc/powerpc64/le/libc.abilist   |  4 ++++
 .../powerpc/powerpc64/le/libpthread.abilist   |  3 +--
 .../unix/sysv/linux/riscv/rv32/libc.abilist   |  4 ++++
 .../sysv/linux/riscv/rv32/libpthread.abilist  |  2 --
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |  4 ++++
 .../sysv/linux/riscv/rv64/libpthread.abilist  |  3 +--
 .../unix/sysv/linux/s390/s390-32/libc.abilist |  5 ++++
 .../linux/s390/s390-32/libpthread.abilist     |  5 ++--
 .../unix/sysv/linux/s390/s390-64/libc.abilist |  4 ++++
 .../linux/s390/s390-64/libpthread.abilist     |  3 +--
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |  4 ++++
 .../unix/sysv/linux/sh/be/libpthread.abilist  |  3 +--
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |  4 ++++
 .../unix/sysv/linux/sh/le/libpthread.abilist  |  3 +--
 .../sysv/linux/sparc/sparc32/libc.abilist     |  5 ++++
 .../linux/sparc/sparc32/libpthread.abilist    |  5 ++--
 .../sysv/linux/sparc/sparc64/libc.abilist     |  4 ++++
 .../linux/sparc/sparc64/libpthread.abilist    |  3 +--
 .../unix/sysv/linux/x86_64/64/libc.abilist    |  4 ++++
 .../sysv/linux/x86_64/64/libpthread.abilist   |  3 +--
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |  4 ++++
 .../sysv/linux/x86_64/x32/libpthread.abilist  |  3 +--
 73 files changed, 233 insertions(+), 104 deletions(-)
 delete mode 100644 sysdeps/nptl/thrd_create.c

diff --git a/include/libc-internal.h b/include/libc-internal.h
index 5b18c7c9f2..749dfb919c 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -38,7 +38,11 @@ extern void __libc_freeres (void);
 libc_hidden_proto (__libc_freeres)
 
 /* Free resources stored in thread-local variables on thread exit.  */
-extern void __libc_thread_freeres (void);
+extern void __libc_thread_freeres (void)
+#if PTHREAD_IN_LIBC
+  attribute_hidden
+#endif
+  ;
 
 /* Define and initialize `__progname' et. al.  */
 extern void __init_misc (int, char **, char **) attribute_hidden;
diff --git a/nptl/Makefile b/nptl/Makefile
index 700027c298..a6e3b615a8 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -108,6 +108,7 @@ routines = \
   pthread_condattr_init \
   pthread_condattr_setclock \
   pthread_condattr_setpshared \
+  pthread_create \
   pthread_detach \
   pthread_equal \
   pthread_exit \
@@ -210,7 +211,6 @@ libpthread-routines = \
   libpthread-compat \
   nptl-init \
   pt-interp \
-  pthread_create \
   version \
 
 libpthread-shared-only-routines = \
diff --git a/nptl/Versions b/nptl/Versions
index 845001847b..0db56bce29 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -38,6 +38,7 @@ libc {
     pthread_cond_wait;
     pthread_condattr_destroy;
     pthread_condattr_init;
+    pthread_create;
     pthread_detach;
     pthread_equal;
     pthread_exit;
@@ -80,6 +81,7 @@ libc {
     pthread_attr_setguardsize;
     pthread_attr_setstackaddr;
     pthread_attr_setstacksize;
+    pthread_create;
     pthread_getconcurrency;
     pthread_mutexattr_gettype;
     pthread_mutexattr_settype;
@@ -217,6 +219,7 @@ libc {
     mtx_trylock;
     mtx_unlock;
     thrd_current;
+    thrd_create;
     thrd_detach;
     thrd_equal;
     thrd_exit;
@@ -358,6 +361,7 @@ libc {
     sem_trywait;
     sem_unlink;
     sem_wait;
+    thrd_create;
     thrd_detach;
     thrd_exit;
     thrd_join;
@@ -409,8 +413,6 @@ libc {
     __pthread_enable_asynccancel;
     __pthread_force_elision;
     __pthread_get_minstack;
-    __pthread_getattr_default_np;
-    __pthread_getattr_default_np;
     __pthread_keys;
     __pthread_mutex_unlock_usercnt;
     __pthread_setcancelstate;
@@ -438,7 +440,7 @@ libpthread {
   }
 
   GLIBC_2.1 {
-    pthread_create;
+    __libpthread_version_placeholder;
   }
 
   GLIBC_2.1.1 {
@@ -495,9 +497,11 @@ libpthread {
   GLIBC_2.19 {
   }
 
-  # C11 thread symbols.
   GLIBC_2.28 {
-    thrd_create;
+    __libpthread_version_placeholder;
+  }
+
+  GLIBC_2.29 {
   }
 
   GLIBC_2.30 {
diff --git a/nptl/libpthread-compat.c b/nptl/libpthread-compat.c
index 7e3e7aa0c3..2dcf175f3f 100644
--- a/nptl/libpthread-compat.c
+++ b/nptl/libpthread-compat.c
@@ -28,14 +28,11 @@ __libpthread_version_placeholder_1 (void)
 }
 #endif
 
-/* This is an unused compatibility symbol definition, to prevent ld
-   from creating a weak version definition for GLIBC_2.1.2.  (__vfork
-   used to be defined at that version, but it is now provided by libc,
-   and there are no versions left in libpthread for that symbol
-   version.)  If the ABI baseline for glibc is the GLIBC_2.2 symbol
-   version or later, the placeholder symbol is not needed because
-   there are plenty of other symbols which populate those later
-   versions.  */
+#if (SHLIB_COMPAT (libpthread, GLIBC_2_1, GLIBC_2_2))
+compat_symbol (libpthread, __libpthread_version_placeholder_1,
+	       __libpthread_version_placeholder, GLIBC_2_1);
+#endif
+
 #if (SHLIB_COMPAT (libpthread, GLIBC_2_1_1, GLIBC_2_1_2))
 compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_1_1);
@@ -45,12 +42,8 @@ compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_1_2);
 #endif
 
-/* Do not create the placeholder symbol version if there are other
-   symbols left that keep the version around (because GLIBC_2.0 got
-   promoted to GLIBC_2.2).  */
 #if SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_2_3) \
-  && ABI_libpthread_GLIBC_2_2 != ABI_libpthread_GLIBC_2_0 \
-  && ABI_libpthread_GLIBC_2_2 != ABI_libpthread_GLIBC_2_1_3
+  && ABI_libpthread_GLIBC_2_2 != ABI_libpthread_GLIBC_2_0
 compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_2);
 #endif
@@ -101,6 +94,11 @@ compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_18);
 #endif
 
+#if (SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_29))
+compat_symbol (libpthread, __libpthread_version_placeholder_1,
+	       __libpthread_version_placeholder, GLIBC_2_28);
+#endif
+
 #if (SHLIB_COMPAT (libpthread, GLIBC_2_30, GLIBC_2_31))
 compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_30);
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 3151842891..05f2bae521 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -314,9 +314,10 @@ libc_hidden_proto (__pthread_cleanup_upto)
 
 
 /* Functions with versioned interfaces.  */
-extern int __pthread_create_2_1 (pthread_t *newthread,
-				 const pthread_attr_t *attr,
-				 void *(*start_routine) (void *), void *arg);
+extern int __pthread_create (pthread_t *newthread,
+			     const pthread_attr_t *attr,
+			     void *(*start_routine) (void *), void *arg);
+libc_hidden_proto (__pthread_create)
 extern int __pthread_create_2_0 (pthread_t *newthread,
 				 const pthread_attr_t *attr,
 				 void *(*start_routine) (void *), void *arg);
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 438b8a7ae1..5680687efe 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -762,10 +762,17 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
 
   return retval;
 }
-versioned_symbol (libpthread, __pthread_create_2_1, pthread_create, GLIBC_2_1);
+versioned_symbol (libc, __pthread_create_2_1, pthread_create, GLIBC_2_34);
+libc_hidden_ver (__pthread_create_2_1, __pthread_create)
+#ifndef SHARED
+strong_alias (__pthread_create_2_1, __pthread_create)
+#endif
 
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_1, GLIBC_2_34)
+compat_symbol (libpthread, __pthread_create_2_1, pthread_create, GLIBC_2_1);
+#endif
 
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
 int
 __pthread_create_2_0 (pthread_t *newthread, const pthread_attr_t *attr,
 		      void *(*start_routine) (void *), void *arg)
diff --git a/nptl/pthread_getattr_default_np.c b/nptl/pthread_getattr_default_np.c
index f38f687431..ad10a27339 100644
--- a/nptl/pthread_getattr_default_np.c
+++ b/nptl/pthread_getattr_default_np.c
@@ -29,8 +29,10 @@ ___pthread_getattr_default_np (pthread_attr_t *out)
 }
 versioned_symbol (libc, ___pthread_getattr_default_np,
                   pthread_getattr_default_np, GLIBC_2_34);
-versioned_symbol (libc, ___pthread_getattr_default_np,
-                  __pthread_getattr_default_np, GLIBC_PRIVATE);
+libc_hidden_ver (___pthread_getattr_default_np, __pthread_getattr_default_np)
+#ifndef SHARED
+strong_alias (___pthread_getattr_default_np, __pthread_getattr_default_np)
+#endif
 
 #if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_18, GLIBC_2_34)
 compat_symbol (libpthread, ___pthread_getattr_default_np,
diff --git a/nptl_db/Makefile b/nptl_db/Makefile
index 8873a0a0ee..ea721c1dcf 100644
--- a/nptl_db/Makefile
+++ b/nptl_db/Makefile
@@ -56,7 +56,7 @@ tests-special += $(objpfx)db-symbols.out
 include ../Rules
 
 $(objpfx)db-symbols.out: $(objpfx)db-symbols.v.i \
-			 $(common-objpfx)nptl/libpthread.so
+			 $(common-objpfx)libc.so
 	LC_ALL=C $(READELF) -W -s $(filter %.so,$^) | $(AWK) -f $< > $@; \
 	$(evaluate-test)
 
diff --git a/nptl_db/structs.def b/nptl_db/structs.def
index 71c9f7bfc2..6a726f207e 100644
--- a/nptl_db/structs.def
+++ b/nptl_db/structs.def
@@ -1,4 +1,4 @@
-/* List of types and symbols in libpthread examined by libthread_db.
+/* List of types and symbols in libc examined by libthread_db.
    Copyright (C) 2003-2021 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -27,7 +27,7 @@
 #endif
 
 /* DB_MAIN_VARIABLE, DB_MAIN_SYMBOL, DB_MAIN_ARRAY_VARIABLE are not
-   covered by the libpthread symbol check in db-symbols.awk.  */
+   covered by the libc symbol check in db-symbols.awk.  */
 #ifndef DB_MAIN_VARIABLE
 # define DB_MAIN_VARIABLE(name) DB_VARIABLE (name)
 #endif
@@ -39,7 +39,7 @@
 #endif
 
 #ifndef DB_RTLD_GLOBAL_FIELD
-# if !IS_IN (libpthread)
+# if !IS_IN (libc)
 #  define DB_RTLD_GLOBAL_FIELD(field)		\
   DB_STRUCT_FIELD (rtld_global, _##field)	\
   DB_MAIN_VARIABLE (_##field)
@@ -103,11 +103,11 @@ DB_STRUCT_ARRAY_FIELD (dtv, dtv)
 #define pointer_val pointer.val /* Field of anonymous struct in dtv_t.  */
 DB_STRUCT_FIELD (dtv_t, pointer_val)
 DB_STRUCT_FIELD (dtv_t, counter)
-#if !IS_IN (libpthread) || TLS_TCB_AT_TP
+#if !IS_IN (libc) || TLS_TCB_AT_TP
 DB_STRUCT_FIELD (pthread, dtvp)
 #endif
 
-#if !(IS_IN (libpthread) && !defined SHARED)
+#if !(IS_IN (libc) && !defined SHARED)
 DB_VARIABLE (__nptl_rtld_global)
 #endif
 DB_RTLD_GLOBAL_FIELD (dl_tls_dtv_slotinfo_list)
diff --git a/sysdeps/nptl/thrd_create.c b/sysdeps/nptl/thrd_create.c
deleted file mode 100644
index 596a7ba588..0000000000
--- a/sysdeps/nptl/thrd_create.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define __pthread_create __pthread_create_2_1
-#include <sysdeps/pthread/thrd_create.c>
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index b15d085f51..bca642f438 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -31,8 +31,6 @@ headers += threads.h
 
 routines += thrd_current thrd_equal thrd_sleep thrd_yield
 
-libpthread-routines += thrd_create
-
 $(libpthread-routines-var) += \
   call_once \
   cnd_broadcast \
@@ -47,6 +45,7 @@ $(libpthread-routines-var) += \
   mtx_timedlock \
   mtx_trylock \
   mtx_unlock \
+  thrd_create \
   thrd_detach \
   thrd_exit \
   thrd_join \
diff --git a/sysdeps/pthread/thrd_create.c b/sysdeps/pthread/thrd_create.c
index 07848c0aab..3cb9f1cefb 100644
--- a/sysdeps/pthread/thrd_create.c
+++ b/sysdeps/pthread/thrd_create.c
@@ -17,9 +17,10 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include "thrd_priv.h"
+#include <shlib-compat.h>
 
 int
-thrd_create (thrd_t *thr, thrd_start_t func, void *arg)
+__thrd_create (thrd_t *thr, thrd_start_t func, void *arg)
 {
   _Static_assert (sizeof (thrd_t) == sizeof (pthread_t),
 		  "sizeof (thrd_t) != sizeof (pthread_t)");
@@ -28,3 +29,11 @@ thrd_create (thrd_t *thr, thrd_start_t func, void *arg)
 				   (void* (*) (void*))func, arg);
   return thrd_err_map (err_code);
 }
+#if PTHREAD_IN_LIBC
+versioned_symbol (libc, __thrd_create, thrd_create, GLIBC_2_34);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
+compat_symbol (libc, __thrd_create, thrd_create, GLIBC_2_28);
+# endif
+#else /* !PTHREAD_IN_LIBC */
+strong_alias (__thrd_create, thrd_create)
+#endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index bc051ba9f5..d22c7da7ef 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -1488,6 +1488,7 @@ GLIBC_2.17 pthread_condattr_getpshared F
 GLIBC_2.17 pthread_condattr_init F
 GLIBC_2.17 pthread_condattr_setclock F
 GLIBC_2.17 pthread_condattr_setpshared F
+GLIBC_2.17 pthread_create F
 GLIBC_2.17 pthread_detach F
 GLIBC_2.17 pthread_equal F
 GLIBC_2.17 pthread_exit F
@@ -2277,6 +2278,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2370,6 +2372,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2442,6 +2445,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
index 3c03fcc17b..14ada15a35 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
@@ -1,6 +1,5 @@
 GLIBC_2.17 __errno_location F
-GLIBC_2.17 pthread_create F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index 3bea473d00..cefff3bf36 100644
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -898,6 +898,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1620,6 +1621,7 @@ GLIBC_2.1 pthread_attr_init F
 GLIBC_2.1 pthread_attr_setguardsize F
 GLIBC_2.1 pthread_attr_setstackaddr F
 GLIBC_2.1 pthread_attr_setstacksize F
+GLIBC_2.1 pthread_create F
 GLIBC_2.1 pthread_getconcurrency F
 GLIBC_2.1 pthread_mutexattr_gettype F
 GLIBC_2.1 pthread_mutexattr_settype F
@@ -2166,6 +2168,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2461,6 +2464,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2533,6 +2537,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
index c8f065b787..47cbcf3baf 100644
--- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
@@ -1,6 +1,5 @@
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 pthread_create F
-GLIBC_2.1 pthread_create F
+GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
 GLIBC_2.11 __libpthread_version_placeholder F
@@ -9,7 +8,7 @@ GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist
index 3461527c5a..91a90f8ca4 100644
--- a/sysdeps/unix/sysv/linux/arc/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libc.abilist
@@ -1429,6 +1429,7 @@ GLIBC_2.32 pthread_condattr_getpshared F
 GLIBC_2.32 pthread_condattr_init F
 GLIBC_2.32 pthread_condattr_setclock F
 GLIBC_2.32 pthread_condattr_setpshared F
+GLIBC_2.32 pthread_create F
 GLIBC_2.32 pthread_detach F
 GLIBC_2.32 pthread_equal F
 GLIBC_2.32 pthread_exit F
@@ -1889,6 +1890,7 @@ GLIBC_2.32 tempnam F
 GLIBC_2.32 textdomain F
 GLIBC_2.32 tfind F
 GLIBC_2.32 tgkill F
+GLIBC_2.32 thrd_create F
 GLIBC_2.32 thrd_current F
 GLIBC_2.32 thrd_detach F
 GLIBC_2.32 thrd_equal F
@@ -2129,6 +2131,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2201,6 +2204,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/arc/libpthread.abilist b/sysdeps/unix/sysv/linux/arc/libpthread.abilist
index 1d363aa47f..c4264810e6 100644
--- a/sysdeps/unix/sysv/linux/arc/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libpthread.abilist
@@ -1,3 +1 @@
 GLIBC_2.32 __errno_location F
-GLIBC_2.32 pthread_create F
-GLIBC_2.32 thrd_create F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
index 7c3029a7e5..120288d766 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist
@@ -140,6 +140,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -236,6 +237,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -308,6 +310,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
@@ -1740,6 +1743,7 @@ GLIBC_2.4 pthread_condattr_getpshared F
 GLIBC_2.4 pthread_condattr_init F
 GLIBC_2.4 pthread_condattr_setclock F
 GLIBC_2.4 pthread_condattr_setpshared F
+GLIBC_2.4 pthread_create F
 GLIBC_2.4 pthread_detach F
 GLIBC_2.4 pthread_equal F
 GLIBC_2.4 pthread_exit F
diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
index 0ad6524820..f8ebb4cae2 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
@@ -1,9 +1,8 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
 GLIBC_2.4 __errno_location F
 GLIBC_2.4 __libpthread_version_placeholder F
-GLIBC_2.4 pthread_create F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
index 24f5b202e8..be987da77e 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist
@@ -140,6 +140,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -233,6 +234,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -305,6 +307,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
@@ -1737,6 +1740,7 @@ GLIBC_2.4 pthread_condattr_getpshared F
 GLIBC_2.4 pthread_condattr_init F
 GLIBC_2.4 pthread_condattr_setclock F
 GLIBC_2.4 pthread_condattr_setpshared F
+GLIBC_2.4 pthread_create F
 GLIBC_2.4 pthread_detach F
 GLIBC_2.4 pthread_equal F
 GLIBC_2.4 pthread_exit F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
index 0ad6524820..f8ebb4cae2 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
@@ -1,9 +1,8 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
 GLIBC_2.4 __errno_location F
 GLIBC_2.4 __libpthread_version_placeholder F
-GLIBC_2.4 pthread_create F
diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist
index 85851c5fca..adb4e15cb8 100644
--- a/sysdeps/unix/sysv/linux/csky/libc.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libc.abilist
@@ -1488,6 +1488,7 @@ GLIBC_2.29 pthread_condattr_getpshared F
 GLIBC_2.29 pthread_condattr_init F
 GLIBC_2.29 pthread_condattr_setclock F
 GLIBC_2.29 pthread_condattr_setpshared F
+GLIBC_2.29 pthread_create F
 GLIBC_2.29 pthread_detach F
 GLIBC_2.29 pthread_equal F
 GLIBC_2.29 pthread_exit F
@@ -1979,6 +1980,7 @@ GLIBC_2.29 telldir F
 GLIBC_2.29 tempnam F
 GLIBC_2.29 textdomain F
 GLIBC_2.29 tfind F
+GLIBC_2.29 thrd_create F
 GLIBC_2.29 thrd_current F
 GLIBC_2.29 thrd_detach F
 GLIBC_2.29 thrd_equal F
@@ -2313,6 +2315,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2385,6 +2388,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
index d2f66f45ff..f7649b87b2 100644
--- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
@@ -1,5 +1,3 @@
 GLIBC_2.29 __errno_location F
-GLIBC_2.29 pthread_create F
-GLIBC_2.29 thrd_create F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index ede69c7ed5..bd022276e8 100644
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -1312,6 +1312,7 @@ GLIBC_2.2 pthread_condattr_destroy F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_detach F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
@@ -1999,6 +2000,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2266,6 +2268,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2338,6 +2341,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
index cc941573b6..f1adf37ff2 100644
--- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
@@ -2,10 +2,9 @@ GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 pthread_create F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index c883dc08bc..9e37e1cb38 100644
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -875,6 +875,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1588,6 +1589,7 @@ GLIBC_2.1 pthread_attr_init F
 GLIBC_2.1 pthread_attr_setguardsize F
 GLIBC_2.1 pthread_attr_setstackaddr F
 GLIBC_2.1 pthread_attr_setstacksize F
+GLIBC_2.1 pthread_create F
 GLIBC_2.1 pthread_getconcurrency F
 GLIBC_2.1 pthread_mutexattr_gettype F
 GLIBC_2.1 pthread_mutexattr_settype F
@@ -2179,6 +2181,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2449,6 +2452,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2521,6 +2525,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
index c8f065b787..47cbcf3baf 100644
--- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
@@ -1,6 +1,5 @@
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 pthread_create F
-GLIBC_2.1 pthread_create F
+GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
 GLIBC_2.11 __libpthread_version_placeholder F
@@ -9,7 +8,7 @@ GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index 38fb02e32b..b8089b0b0c 100644
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -1333,6 +1333,7 @@ GLIBC_2.2 pthread_condattr_destroy F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_detach F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
@@ -2034,6 +2035,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2302,6 +2304,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2374,6 +2377,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
index cc941573b6..f1adf37ff2 100644
--- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
@@ -2,10 +2,9 @@ GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 pthread_create F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index 8ee9648828..093854ad85 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -141,6 +141,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -237,6 +238,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -309,6 +311,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
@@ -1720,6 +1723,7 @@ GLIBC_2.4 pthread_condattr_getpshared F
 GLIBC_2.4 pthread_condattr_init F
 GLIBC_2.4 pthread_condattr_setclock F
 GLIBC_2.4 pthread_condattr_setpshared F
+GLIBC_2.4 pthread_create F
 GLIBC_2.4 pthread_detach F
 GLIBC_2.4 pthread_equal F
 GLIBC_2.4 pthread_exit F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
index 0ad6524820..f8ebb4cae2 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
@@ -1,9 +1,8 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
 GLIBC_2.4 __errno_location F
 GLIBC_2.4 __libpthread_version_placeholder F
-GLIBC_2.4 pthread_create F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index 1c51cb41ec..87554f1468 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -874,6 +874,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1584,6 +1585,7 @@ GLIBC_2.1 pthread_attr_init F
 GLIBC_2.1 pthread_attr_setguardsize F
 GLIBC_2.1 pthread_attr_setstackaddr F
 GLIBC_2.1 pthread_attr_setstacksize F
+GLIBC_2.1 pthread_create F
 GLIBC_2.1 pthread_getconcurrency F
 GLIBC_2.1 pthread_mutexattr_gettype F
 GLIBC_2.1 pthread_mutexattr_settype F
@@ -2122,6 +2124,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2392,6 +2395,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2464,6 +2468,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
index c8f065b787..47cbcf3baf 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
@@ -1,6 +1,5 @@
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 pthread_create F
-GLIBC_2.1 pthread_create F
+GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
 GLIBC_2.11 __libpthread_version_placeholder F
@@ -9,7 +8,7 @@ GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
index f8b67cd170..e9340671c5 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
@@ -1490,6 +1490,7 @@ GLIBC_2.18 pthread_condattr_getpshared F
 GLIBC_2.18 pthread_condattr_init F
 GLIBC_2.18 pthread_condattr_setclock F
 GLIBC_2.18 pthread_condattr_setpshared F
+GLIBC_2.18 pthread_create F
 GLIBC_2.18 pthread_detach F
 GLIBC_2.18 pthread_equal F
 GLIBC_2.18 pthread_exit F
@@ -2268,6 +2269,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2364,6 +2366,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2436,6 +2439,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
index 921e604dbe..c99c8b026c 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
@@ -1,5 +1,4 @@
 GLIBC_2.18 __errno_location F
-GLIBC_2.18 pthread_create F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
index edac4a1bb4..6ddc0e90cf 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
@@ -1490,6 +1490,7 @@ GLIBC_2.18 pthread_condattr_getpshared F
 GLIBC_2.18 pthread_condattr_init F
 GLIBC_2.18 pthread_condattr_setclock F
 GLIBC_2.18 pthread_condattr_setpshared F
+GLIBC_2.18 pthread_create F
 GLIBC_2.18 pthread_detach F
 GLIBC_2.18 pthread_equal F
 GLIBC_2.18 pthread_exit F
@@ -2268,6 +2269,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2361,6 +2363,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2433,6 +2436,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
index 921e604dbe..c99c8b026c 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
@@ -1,5 +1,4 @@
 GLIBC_2.18 __errno_location F
-GLIBC_2.18 pthread_create F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index db900c89ab..8582c9c371 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -871,6 +871,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1869,6 +1870,7 @@ GLIBC_2.2 pthread_barrierattr_init F
 GLIBC_2.2 pthread_barrierattr_setpshared F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_getconcurrency F
 GLIBC_2.2 pthread_getcpuclockid F
 GLIBC_2.2 pthread_mutex_timedlock F
@@ -2092,6 +2094,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2357,6 +2360,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2429,6 +2433,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
index a5f3d5ce2a..2d0b9e3542 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
@@ -1,12 +1,11 @@
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 pthread_create F
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.2 pthread_create F
+GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 4e15f48b6c..b0849bec98 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -871,6 +871,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1867,6 +1868,7 @@ GLIBC_2.2 pthread_barrierattr_init F
 GLIBC_2.2 pthread_barrierattr_setpshared F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_getconcurrency F
 GLIBC_2.2 pthread_getcpuclockid F
 GLIBC_2.2 pthread_mutex_timedlock F
@@ -2090,6 +2092,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2355,6 +2358,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2427,6 +2431,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
index a5f3d5ce2a..2d0b9e3542 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
@@ -1,12 +1,11 @@
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 pthread_create F
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.2 pthread_create F
+GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index 616a6076f1..386660a5a1 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -871,6 +871,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1867,6 +1868,7 @@ GLIBC_2.2 pthread_barrierattr_init F
 GLIBC_2.2 pthread_barrierattr_setpshared F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_getconcurrency F
 GLIBC_2.2 pthread_getcpuclockid F
 GLIBC_2.2 pthread_mutex_timedlock F
@@ -2098,6 +2100,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2363,6 +2366,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2435,6 +2439,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index 59a353d306..4d05128f21 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -869,6 +869,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1863,6 +1864,7 @@ GLIBC_2.2 pthread_barrierattr_init F
 GLIBC_2.2 pthread_barrierattr_setpshared F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_getconcurrency F
 GLIBC_2.2 pthread_getcpuclockid F
 GLIBC_2.2 pthread_mutex_timedlock F
@@ -2093,6 +2095,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2357,6 +2360,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2429,6 +2433,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index 0fc42897aa..bd305f440f 100644
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -1533,6 +1533,7 @@ GLIBC_2.21 pthread_condattr_getpshared F
 GLIBC_2.21 pthread_condattr_init F
 GLIBC_2.21 pthread_condattr_setclock F
 GLIBC_2.21 pthread_condattr_setpshared F
+GLIBC_2.21 pthread_create F
 GLIBC_2.21 pthread_detach F
 GLIBC_2.21 pthread_equal F
 GLIBC_2.21 pthread_exit F
@@ -2310,6 +2311,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2403,6 +2405,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2475,6 +2478,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
index f36733746e..4d8ff6a262 100644
--- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
@@ -1,5 +1,4 @@
 GLIBC_2.21 __errno_location F
-GLIBC_2.21 pthread_create F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index 553ecdabc9..c2665624aa 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -882,6 +882,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1592,6 +1593,7 @@ GLIBC_2.1 pthread_attr_init F
 GLIBC_2.1 pthread_attr_setguardsize F
 GLIBC_2.1 pthread_attr_setstackaddr F
 GLIBC_2.1 pthread_attr_setstacksize F
+GLIBC_2.1 pthread_create F
 GLIBC_2.1 pthread_getconcurrency F
 GLIBC_2.1 pthread_mutexattr_gettype F
 GLIBC_2.1 pthread_mutexattr_settype F
@@ -2126,6 +2128,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2419,6 +2422,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2491,6 +2495,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
index 84a1592904..e545bcc56c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
@@ -1,6 +1,5 @@
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 pthread_create F
-GLIBC_2.1 pthread_create F
+GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
 GLIBC_2.11 __libpthread_version_placeholder F
@@ -9,7 +8,7 @@ GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index 7ec438f7b4..13ef6ef39e 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -882,6 +882,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1592,6 +1593,7 @@ GLIBC_2.1 pthread_attr_init F
 GLIBC_2.1 pthread_attr_setguardsize F
 GLIBC_2.1 pthread_attr_setstackaddr F
 GLIBC_2.1 pthread_attr_setstacksize F
+GLIBC_2.1 pthread_create F
 GLIBC_2.1 pthread_getconcurrency F
 GLIBC_2.1 pthread_mutexattr_gettype F
 GLIBC_2.1 pthread_mutexattr_settype F
@@ -2130,6 +2132,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2452,6 +2455,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2524,6 +2528,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
index f382e3e296..b21072e313 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
@@ -140,6 +140,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -1437,6 +1438,7 @@ GLIBC_2.3 pthread_condattr_destroy F
 GLIBC_2.3 pthread_condattr_getpshared F
 GLIBC_2.3 pthread_condattr_init F
 GLIBC_2.3 pthread_condattr_setpshared F
+GLIBC_2.3 pthread_create F
 GLIBC_2.3 pthread_detach F
 GLIBC_2.3 pthread_equal F
 GLIBC_2.3 pthread_exit F
@@ -2267,6 +2269,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2339,6 +2342,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
index b66279a352..e10c836946 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
@@ -1,9 +1,8 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3 __errno_location F
-GLIBC_2.3 pthread_create F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 97ff951418..62af65536c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -1576,6 +1576,7 @@ GLIBC_2.17 pthread_condattr_getpshared F
 GLIBC_2.17 pthread_condattr_init F
 GLIBC_2.17 pthread_condattr_setclock F
 GLIBC_2.17 pthread_condattr_setpshared F
+GLIBC_2.17 pthread_create F
 GLIBC_2.17 pthread_detach F
 GLIBC_2.17 pthread_equal F
 GLIBC_2.17 pthread_exit F
@@ -2367,6 +2368,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2566,6 +2568,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2638,6 +2641,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
index 3c03fcc17b..14ada15a35 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
@@ -1,6 +1,5 @@
 GLIBC_2.17 __errno_location F
-GLIBC_2.17 pthread_create F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
index 5bde5bb508..a63aec3379 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
@@ -1431,6 +1431,7 @@ GLIBC_2.33 pthread_condattr_getpshared F
 GLIBC_2.33 pthread_condattr_init F
 GLIBC_2.33 pthread_condattr_setclock F
 GLIBC_2.33 pthread_condattr_setpshared F
+GLIBC_2.33 pthread_create F
 GLIBC_2.33 pthread_detach F
 GLIBC_2.33 pthread_equal F
 GLIBC_2.33 pthread_exit F
@@ -1899,6 +1900,7 @@ GLIBC_2.33 tempnam F
 GLIBC_2.33 textdomain F
 GLIBC_2.33 tfind F
 GLIBC_2.33 tgkill F
+GLIBC_2.33 thrd_create F
 GLIBC_2.33 thrd_current F
 GLIBC_2.33 thrd_detach F
 GLIBC_2.33 thrd_equal F
@@ -2131,6 +2133,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2203,6 +2206,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
index e9cded0b3c..73188776b6 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
@@ -1,3 +1 @@
 GLIBC_2.33 __errno_location F
-GLIBC_2.33 pthread_create F
-GLIBC_2.33 thrd_create F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
index 42f6d52e13..b52efaf5ee 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
@@ -1478,6 +1478,7 @@ GLIBC_2.27 pthread_condattr_getpshared F
 GLIBC_2.27 pthread_condattr_init F
 GLIBC_2.27 pthread_condattr_setclock F
 GLIBC_2.27 pthread_condattr_setpshared F
+GLIBC_2.27 pthread_create F
 GLIBC_2.27 pthread_detach F
 GLIBC_2.27 pthread_equal F
 GLIBC_2.27 pthread_exit F
@@ -2238,6 +2239,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2331,6 +2333,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2403,6 +2406,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
index 07a3c7f01d..35a6a20935 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
@@ -1,5 +1,4 @@
 GLIBC_2.27 __errno_location F
-GLIBC_2.27 pthread_create F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 2274342208..b699dedcc1 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -873,6 +873,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1584,6 +1585,7 @@ GLIBC_2.1 pthread_attr_init F
 GLIBC_2.1 pthread_attr_setguardsize F
 GLIBC_2.1 pthread_attr_setstackaddr F
 GLIBC_2.1 pthread_attr_setstacksize F
+GLIBC_2.1 pthread_create F
 GLIBC_2.1 pthread_getconcurrency F
 GLIBC_2.1 pthread_mutexattr_gettype F
 GLIBC_2.1 pthread_mutexattr_settype F
@@ -2135,6 +2137,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2417,6 +2420,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2489,6 +2493,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
index faae6bcf76..ac212e942a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
@@ -1,6 +1,5 @@
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 pthread_create F
-GLIBC_2.1 pthread_create F
+GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
 GLIBC_2.11 __libpthread_version_placeholder F
@@ -10,7 +9,7 @@ GLIBC_2.19 __libpthread_version_placeholder F
 GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 14d1c5e7f8..94209858b1 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1330,6 +1330,7 @@ GLIBC_2.2 pthread_condattr_destroy F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_detach F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
@@ -2026,6 +2027,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2304,6 +2306,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2376,6 +2379,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
index ac3a2834dc..e0feab34d5 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
@@ -3,10 +3,9 @@ GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.19 __libpthread_version_placeholder F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 pthread_create F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
index 97942ff01a..0fab90e1e3 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist
@@ -1316,6 +1316,7 @@ GLIBC_2.2 pthread_condattr_destroy F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_detach F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
@@ -2003,6 +2004,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2273,6 +2275,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2345,6 +2348,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
index cc941573b6..f1adf37ff2 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
@@ -2,10 +2,9 @@ GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 pthread_create F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
index 617b673620..2f3a64b580 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist
@@ -1316,6 +1316,7 @@ GLIBC_2.2 pthread_condattr_destroy F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_detach F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
@@ -2003,6 +2004,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2270,6 +2272,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2342,6 +2345,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
index cc941573b6..f1adf37ff2 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
@@ -2,10 +2,9 @@ GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 pthread_create F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 3c6559bb4f..e6fe453f50 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -876,6 +876,7 @@ GLIBC_2.0 pthread_cond_timedwait F
 GLIBC_2.0 pthread_cond_wait F
 GLIBC_2.0 pthread_condattr_destroy F
 GLIBC_2.0 pthread_condattr_init F
+GLIBC_2.0 pthread_create F
 GLIBC_2.0 pthread_detach F
 GLIBC_2.0 pthread_equal F
 GLIBC_2.0 pthread_exit F
@@ -1585,6 +1586,7 @@ GLIBC_2.1 pthread_attr_init F
 GLIBC_2.1 pthread_attr_setguardsize F
 GLIBC_2.1 pthread_attr_setstackaddr F
 GLIBC_2.1 pthread_attr_setstacksize F
+GLIBC_2.1 pthread_create F
 GLIBC_2.1 pthread_getconcurrency F
 GLIBC_2.1 pthread_mutexattr_gettype F
 GLIBC_2.1 pthread_mutexattr_settype F
@@ -2129,6 +2131,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2410,6 +2413,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2482,6 +2486,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
index c8f065b787..47cbcf3baf 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
@@ -1,6 +1,5 @@
 GLIBC_2.0 __errno_location F
-GLIBC_2.0 pthread_create F
-GLIBC_2.1 pthread_create F
+GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
 GLIBC_2.11 __libpthread_version_placeholder F
@@ -9,7 +8,7 @@ GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 77f54bb23b..4327cf5eb3 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -1359,6 +1359,7 @@ GLIBC_2.2 pthread_condattr_destroy F
 GLIBC_2.2 pthread_condattr_getpshared F
 GLIBC_2.2 pthread_condattr_init F
 GLIBC_2.2 pthread_condattr_setpshared F
+GLIBC_2.2 pthread_create F
 GLIBC_2.2 pthread_detach F
 GLIBC_2.2 pthread_equal F
 GLIBC_2.2 pthread_exit F
@@ -2056,6 +2057,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2323,6 +2325,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2395,6 +2398,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
index cc941573b6..f1adf37ff2 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
@@ -2,10 +2,9 @@ GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2 __errno_location F
-GLIBC_2.2 pthread_create F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 4035841a1e..318a6d50f9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -1326,6 +1326,7 @@ GLIBC_2.2.5 pthread_condattr_destroy F
 GLIBC_2.2.5 pthread_condattr_getpshared F
 GLIBC_2.2.5 pthread_condattr_init F
 GLIBC_2.2.5 pthread_condattr_setpshared F
+GLIBC_2.2.5 pthread_create F
 GLIBC_2.2.5 pthread_detach F
 GLIBC_2.2.5 pthread_equal F
 GLIBC_2.2.5 pthread_exit F
@@ -2015,6 +2016,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2282,6 +2284,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2354,6 +2357,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
index d3abfb7d11..ec4e3c0ecd 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
@@ -2,9 +2,8 @@ GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.2.5 __errno_location F
-GLIBC_2.2.5 pthread_create F
 GLIBC_2.2.6 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index 61ac187db9..0bcf898d4d 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -1495,6 +1495,7 @@ GLIBC_2.16 pthread_condattr_getpshared F
 GLIBC_2.16 pthread_condattr_init F
 GLIBC_2.16 pthread_condattr_setclock F
 GLIBC_2.16 pthread_condattr_setpshared F
+GLIBC_2.16 pthread_create F
 GLIBC_2.16 pthread_detach F
 GLIBC_2.16 pthread_equal F
 GLIBC_2.16 pthread_exit F
@@ -2290,6 +2291,7 @@ GLIBC_2.28 mtx_trylock F
 GLIBC_2.28 mtx_unlock F
 GLIBC_2.28 renameat2 F
 GLIBC_2.28 statx F
+GLIBC_2.28 thrd_create F
 GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_detach F
 GLIBC_2.28 thrd_equal F
@@ -2385,6 +2387,7 @@ GLIBC_2.34 pthread_condattr_getclock F
 GLIBC_2.34 pthread_condattr_getpshared F
 GLIBC_2.34 pthread_condattr_setclock F
 GLIBC_2.34 pthread_condattr_setpshared F
+GLIBC_2.34 pthread_create F
 GLIBC_2.34 pthread_detach F
 GLIBC_2.34 pthread_getattr_default_np F
 GLIBC_2.34 pthread_getconcurrency F
@@ -2457,6 +2460,7 @@ GLIBC_2.34 sem_timedwait F
 GLIBC_2.34 sem_trywait F
 GLIBC_2.34 sem_unlink F
 GLIBC_2.34 sem_wait F
+GLIBC_2.34 thrd_create F
 GLIBC_2.34 thrd_detach F
 GLIBC_2.34 thrd_exit F
 GLIBC_2.34 thrd_join F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
index af42dea518..cc6e073a11 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
@@ -1,6 +1,5 @@
 GLIBC_2.16 __errno_location F
-GLIBC_2.16 pthread_create F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.28 thrd_create F
+GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
-- 
2.31.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 6/8] nptl: Remove remaining code from libpthread
  2021-05-21 12:45 [PATCH v2 0/8] nptl: Complete libpthread move Florian Weimer
                   ` (4 preceding siblings ...)
  2021-05-21 12:45 ` [PATCH 5/8] nptl: Move pthread_create, thrd_create into libc Florian Weimer
@ 2021-05-21 12:46 ` 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-21 12:46 ` [PATCH 8/8] Linux: Remove remaining references to $(shared-thread-library) Florian Weimer
  7 siblings, 0 replies; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 12:46 UTC (permalink / raw)
  To: libc-alpha

Only the placeholder compatibility symbols are left now.

The __errno_location symbol was removed (moved) using
scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
---
 nptl/Makefile                                 | 46 ++---------------
 nptl/Versions                                 | 12 +----
 nptl/libpthread-compat.c                      | 10 ++--
 nptl/nptl-init.c                              | 46 -----------------
 nptl/pt-crti.S                                | 50 -------------------
 nptl/pt-interp.c                              |  1 -
 nptl/version.c                                | 41 ---------------
 sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c       |  1 -
 sysdeps/arm/nptl/Makefile                     |  3 --
 sysdeps/ia64/nptl/Makefile                    |  5 --
 sysdeps/mips/Makefile                         |  5 --
 sysdeps/mips/nptl/Makefile                    |  5 --
 sysdeps/mips/nptl/nptl-sysdep.S               |  2 -
 sysdeps/nptl/Makefile                         |  4 --
 sysdeps/riscv/nptl/Makefile                   |  5 --
 sysdeps/riscv/nptl/nptl-sysdep.S              |  2 -
 sysdeps/s390/nptl/Makefile                    |  5 --
 sysdeps/sparc/Makefile                        |  4 --
 sysdeps/sparc/nptl/Makefile                   |  5 --
 .../sysv/linux/aarch64/libpthread.abilist     |  2 +-
 sysdeps/unix/sysv/linux/alpha/Makefile        |  6 ---
 .../unix/sysv/linux/alpha/libpthread.abilist  |  2 +-
 .../unix/sysv/linux/arc/libpthread.abilist    |  2 +-
 sysdeps/unix/sysv/linux/arm/Makefile          |  5 --
 .../unix/sysv/linux/arm/be/libpthread.abilist |  1 -
 .../unix/sysv/linux/arm/le/libpthread.abilist |  1 -
 .../unix/sysv/linux/csky/libpthread.abilist   |  2 +-
 .../unix/sysv/linux/hppa/libpthread.abilist   |  2 +-
 sysdeps/unix/sysv/linux/i386/Makefile         | 11 ----
 .../unix/sysv/linux/i386/libpthread.abilist   |  2 +-
 .../unix/sysv/linux/ia64/libpthread.abilist   |  2 +-
 .../linux/m68k/coldfire/libpthread.abilist    |  1 -
 .../sysv/linux/m68k/m680x0/libpthread.abilist |  2 +-
 sysdeps/unix/sysv/linux/microblaze/Makefile   |  6 ---
 .../linux/microblaze/be/libpthread.abilist    |  2 +-
 .../linux/microblaze/le/libpthread.abilist    |  2 +-
 .../sysv/linux/mips/mips32/libpthread.abilist |  2 +-
 .../sysv/linux/mips/mips64/libpthread.abilist |  2 +-
 .../unix/sysv/linux/nios2/libpthread.abilist  |  2 +-
 sysdeps/unix/sysv/linux/powerpc/Makefile      |  5 --
 .../powerpc/powerpc32/libpthread.abilist      |  2 +-
 .../powerpc/powerpc64/be/libpthread.abilist   |  2 +-
 .../powerpc/powerpc64/le/libpthread.abilist   |  2 +-
 .../sysv/linux/riscv/rv32/libpthread.abilist  |  2 +-
 .../sysv/linux/riscv/rv64/libpthread.abilist  |  2 +-
 .../linux/s390/s390-32/libpthread.abilist     |  2 +-
 .../linux/s390/s390-64/libpthread.abilist     |  2 +-
 .../unix/sysv/linux/sh/be/libpthread.abilist  |  2 +-
 .../unix/sysv/linux/sh/le/libpthread.abilist  |  2 +-
 sysdeps/unix/sysv/linux/sparc/Makefile        |  6 ---
 .../linux/sparc/sparc32/libpthread.abilist    |  2 +-
 .../linux/sparc/sparc64/libpthread.abilist    |  2 +-
 .../sysv/linux/x86_64/64/libpthread.abilist   |  2 +-
 .../sysv/linux/x86_64/x32/libpthread.abilist  |  2 +-
 54 files changed, 37 insertions(+), 309 deletions(-)
 delete mode 100644 nptl/nptl-init.c
 delete mode 100644 nptl/pt-crti.S
 delete mode 100644 nptl/pt-interp.c
 delete mode 100644 nptl/version.c
 delete mode 100644 sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c
 delete mode 100644 sysdeps/mips/nptl/nptl-sysdep.S
 delete mode 100644 sysdeps/riscv/nptl/nptl-sysdep.S

diff --git a/nptl/Makefile b/nptl/Makefile
index a6e3b615a8..64cd0dcbf6 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -207,16 +207,8 @@ routines = \
 shared-only-routines = forward
 static-only-routines = pthread_atfork
 
-libpthread-routines = \
-  libpthread-compat \
-  nptl-init \
-  pt-interp \
-  version \
-
-libpthread-shared-only-routines = \
-  pt-allocrtsig \
-  pt-interp \
-  version \
+libpthread-routines = libpthread-compat
+libpthread-shared-only-routines = libpthread-compat
 
 # Since cancellation handling is in large parts handled using exceptions
 # we have to compile some files with exception handling enabled, some
@@ -382,7 +374,7 @@ else
 tests-printers-libs := $(static-thread-library)
 endif
 
-LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
+LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete
 
 tests += tst-cancelx7 tst-cancelx17
 
@@ -432,17 +424,6 @@ $(objpfx)multidir.mk: $(common-objpfx)config.make
 	echo "multidir := $$dir" > $@T
 	mv -f $@T $@
 
-crti-objs := crti.o
-crtn-objs := crtn.o
-ifneq (,$(patsubst .,,$(multidir)))
-generated-dirs += $(firstword $(subst /, , $(multidir)))
-crti-objs += $(multidir)/crti.o
-crtn-objs += $(multidir)/crtn.o
-$(objpfx)$(multidir):
-	mkdir -p $@
-endif
-extra-objs += $(crti-objs) $(crtn-objs)
-extra-objs += pt-crti.o
 endif
 
 CFLAGS-ftrylockfile.c += $(libio-mtsafe)
@@ -577,11 +558,6 @@ $(objpfx)tst-cancelx17: $(librt)
 LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++
 LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
 
-extra-B-pthread.so = -B$(common-objpfx)nptl/
-$(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
-$(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))
-$(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
-
 # Make sure we link with the thread library.
 ifeq ($(build-shared),yes)
 $(addprefix $(objpfx), \
@@ -601,23 +577,7 @@ $(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
 endif
 
 ifeq ($(build-shared),yes)
-$(objpfx)crti.o: $(objpfx)pt-crti.o
-	ln -f $< $@
-
-ifneq ($(multidir),.)
-$(objpfx)$(multidir)/crti.o: $(objpfx)crti.o $(objpfx)$(multidir)/
-	ln -f $< $@
-
-$(objpfx)$(multidir)/crtn.o: $(objpfx)crtn.o $(objpfx)$(multidir)/
-	ln -f $< $@
-endif
-
 generated += multidir.mk tst-tls6.out
-
-# Give libpthread.so an entry point and make it directly runnable itself.
-LDFLAGS-pthread.so += -e __nptl_main
-# pt-interp.c exists just to get the runtime linker path into libpthread.so.
-$(objpfx)pt-interp.os: $(common-objpfx)runtime-linker.h
 endif
 
 tst-exec4-ARGS = $(host-test-program-cmd)
diff --git a/nptl/Versions b/nptl/Versions
index 0db56bce29..af62a47cca 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -426,17 +426,7 @@ libc {
 
 libpthread {
   GLIBC_2.0 {
-    _Exit;
-    _IO_flockfile;
-    _IO_ftrylockfile;
-    _IO_funlockfile;
-    __errno_location;
-    _exit;
-    flockfile;
-    ftrylockfile;
-    funlockfile;
-    pthread_create;
-    pthread_sigmask;
+    __libpthread_version_placeholder;
   }
 
   GLIBC_2.1 {
diff --git a/nptl/libpthread-compat.c b/nptl/libpthread-compat.c
index 2dcf175f3f..fb336d0685 100644
--- a/nptl/libpthread-compat.c
+++ b/nptl/libpthread-compat.c
@@ -28,6 +28,11 @@ __libpthread_version_placeholder_1 (void)
 }
 #endif
 
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libpthread, __libpthread_version_placeholder_1,
+	       __libpthread_version_placeholder, GLIBC_2_0);
+#endif
+
 #if (SHLIB_COMPAT (libpthread, GLIBC_2_1, GLIBC_2_2))
 compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_1);
@@ -42,7 +47,7 @@ compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_1_2);
 #endif
 
-#if SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_2_3) \
+#if SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_3) \
   && ABI_libpthread_GLIBC_2_2 != ABI_libpthread_GLIBC_2_0
 compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_2);
@@ -88,8 +93,7 @@ compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_12);
 #endif
 
-#if SHLIB_COMPAT (libpthread, GLIBC_2_18, GLIBC_2_19) \
-  && ABI_libpthread_GLIBC_2_18 != ABI_libpthread_GLIBC_2_0
+#if SHLIB_COMPAT (libpthread, GLIBC_2_18, GLIBC_2_19)
 compat_symbol (libpthread, __libpthread_version_placeholder_1,
 	       __libpthread_version_placeholder, GLIBC_2_18);
 #endif
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
deleted file mode 100644
index 5a460aedba..0000000000
--- a/nptl/nptl-init.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/resource.h>
-#include <pthreadP.h>
-#include <atomic.h>
-#include <ldsodefs.h>
-#include <tls.h>
-#include <list.h>
-#include <version.h>
-#include <shlib-compat.h>
-#include <lowlevellock.h>
-#include <futex-internal.h>
-#include <kernel-features.h>
-#include <libc-pointer-arith.h>
-#include <pthread_mutex_conf.h>
-#include <nptl-stack.h>
-
-void
-__pthread_initialize_minimal_internal (void)
-{
-}
-strong_alias (__pthread_initialize_minimal_internal,
-	      __pthread_initialize_minimal)
diff --git a/nptl/pt-crti.S b/nptl/pt-crti.S
deleted file mode 100644
index e618986f98..0000000000
--- a/nptl/pt-crti.S
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Special .init and .fini section support for libpthread.
-   Copyright (C) 2012-2021 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <elf-initfini.h>
-
-/* Arrange for __pthread_initialize_minimal_internal to be called at
-   libpthread startup, instead of conditionally calling
-   __gmon_start__.  */
-
-#if ELF_INITFINI
-# define PREINIT_FUNCTION __pthread_initialize_minimal_internal
-# define PREINIT_FUNCTION_WEAK 0
-
-# include <crti.S>
-#else
-	.section .init_array,"a",%init_array
-	.dc.a __pthread_initialize_minimal_internal
-#endif
diff --git a/nptl/pt-interp.c b/nptl/pt-interp.c
deleted file mode 100644
index ecf1fe70df..0000000000
--- a/nptl/pt-interp.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <elf/interp.c>
diff --git a/nptl/version.c b/nptl/version.c
deleted file mode 100644
index 25e3a0c872..0000000000
--- a/nptl/version.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Entry point for libpthread DSO.
-   Copyright (C) 2002-2021 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <unistd.h>
-#include <sysdep.h>
-
-
-static const char banner[] =
-"Native POSIX Threads Library\n\
-Copyright (C) 2021 Free Software Foundation, Inc.\n\
-This is free software; see the source for copying conditions.\n\
-There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
-PARTICULAR PURPOSE.\n"
-"Forced unwind support included.\n"
-;
-
-
-/* This is made the e_entry of libpthread.so by LDFLAGS-pthread.so.  */
-__attribute__ ((noreturn))
-void
-__nptl_main (void)
-{
-  write (STDOUT_FILENO, banner, sizeof banner - 1);
-  _exit (0);
-}
diff --git a/sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c b/sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c
deleted file mode 100644
index 7b83522437..0000000000
--- a/sysdeps/arm/nptl-aeabi_unwind_cpp_pr1.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <aeabi_unwind_cpp_pr1.c>
diff --git a/sysdeps/arm/nptl/Makefile b/sysdeps/arm/nptl/Makefile
index 5e4905df2f..44154bff37 100644
--- a/sysdeps/arm/nptl/Makefile
+++ b/sysdeps/arm/nptl/Makefile
@@ -20,9 +20,6 @@ gen-as-const-headers += tcb-offsets.sym
 endif
 
 ifeq ($(subdir),nptl)
-libpthread-sysdep_routines += nptl-aeabi_unwind_cpp_pr1
-libpthread-shared-only-routines += nptl-aeabi_unwind_cpp_pr1
-
 # This test relies on compiling part of the binary with EH information,
 # part without, and unwinding through.  The .ARM.exidx tables have
 # start addresses for EH regions, but no end addresses.  Every
diff --git a/sysdeps/ia64/nptl/Makefile b/sysdeps/ia64/nptl/Makefile
index d8a8fc44fe..d99cfd5b34 100644
--- a/sysdeps/ia64/nptl/Makefile
+++ b/sysdeps/ia64/nptl/Makefile
@@ -18,8 +18,3 @@
 ifeq ($(subdir),csu)
 gen-as-const-headers += tcb-offsets.sym
 endif
-
-ifeq ($(subdir),nptl)
-libpthread-routines += sysdep
-libpthread-shared-only-routines += sysdep
-endif
diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile
index 6ad69e9ef9..19e6a57622 100644
--- a/sysdeps/mips/Makefile
+++ b/sysdeps/mips/Makefile
@@ -17,11 +17,6 @@ CPPFLAGS-crti.S += $(pic-ccflag)
 CPPFLAGS-crtn.S += $(pic-ccflag)
 endif
 
-ifeq ($(subdir),nptl)
-CPPFLAGS-pt-crti.S += $(pic-ccflag)
-CPPFLAGS-crtn.S += $(pic-ccflag)
-endif
-
 ASFLAGS-.os += $(pic-ccflag)
 # libc.a and libc_p.a must be compiled with -fPIE/-fpie for static PIE.
 ASFLAGS-.o += $(pie-default)
diff --git a/sysdeps/mips/nptl/Makefile b/sysdeps/mips/nptl/Makefile
index 87ba580ec2..329a57a473 100644
--- a/sysdeps/mips/nptl/Makefile
+++ b/sysdeps/mips/nptl/Makefile
@@ -18,8 +18,3 @@
 ifeq ($(subdir),csu)
 gen-as-const-headers += tcb-offsets.sym
 endif
-
-ifeq ($(subdir),nptl)
-libpthread-sysdep_routines += nptl-sysdep
-libpthread-shared-only-routines += nptl-sysdep
-endif
diff --git a/sysdeps/mips/nptl/nptl-sysdep.S b/sysdeps/mips/nptl/nptl-sysdep.S
deleted file mode 100644
index 3f5c2a364a..0000000000
--- a/sysdeps/mips/nptl/nptl-sysdep.S
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Pull in __syscall_error.  */
-#include <sysdep.S>
diff --git a/sysdeps/nptl/Makefile b/sysdeps/nptl/Makefile
index 632cd3686b..0707f130eb 100644
--- a/sysdeps/nptl/Makefile
+++ b/sysdeps/nptl/Makefile
@@ -16,10 +16,6 @@
 # License along with the GNU C Library; if not, see
 # <https://www.gnu.org/licenses/>.
 
-ifeq ($(subdir),nptl)
-libpthread-sysdep_routines += errno-loc
-endif
-
 ifeq ($(subdir),rt)
 librt-sysdep_routines += timer_routines
 
diff --git a/sysdeps/riscv/nptl/Makefile b/sysdeps/riscv/nptl/Makefile
index 85ef9cf691..cca67db324 100644
--- a/sysdeps/riscv/nptl/Makefile
+++ b/sysdeps/riscv/nptl/Makefile
@@ -19,8 +19,3 @@
 ifeq ($(subdir),csu)
 gen-as-const-headers += tcb-offsets.sym
 endif
-
-ifeq ($(subdir),nptl)
-libpthread-sysdep_routines += nptl-sysdep
-libpthread-shared-only-routines += nptl-sysdep
-endif
diff --git a/sysdeps/riscv/nptl/nptl-sysdep.S b/sysdeps/riscv/nptl/nptl-sysdep.S
deleted file mode 100644
index 3f5c2a364a..0000000000
--- a/sysdeps/riscv/nptl/nptl-sysdep.S
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Pull in __syscall_error.  */
-#include <sysdep.S>
diff --git a/sysdeps/s390/nptl/Makefile b/sysdeps/s390/nptl/Makefile
index d8a8fc44fe..d99cfd5b34 100644
--- a/sysdeps/s390/nptl/Makefile
+++ b/sysdeps/s390/nptl/Makefile
@@ -18,8 +18,3 @@
 ifeq ($(subdir),csu)
 gen-as-const-headers += tcb-offsets.sym
 endif
-
-ifeq ($(subdir),nptl)
-libpthread-routines += sysdep
-libpthread-shared-only-routines += sysdep
-endif
diff --git a/sysdeps/sparc/Makefile b/sysdeps/sparc/Makefile
index c123b527b5..1be9a3db2c 100644
--- a/sysdeps/sparc/Makefile
+++ b/sysdeps/sparc/Makefile
@@ -30,9 +30,5 @@ ifeq ($(subdir),nscd)
 routines += cpu_relax
 endif
 
-ifeq ($(subdir), nptl)
-libpthread-routines += cpu_relax
-endif
-
 # The assembler on SPARC needs the -fPIC flag even when it's assembler code.
 ASFLAGS-.os += -fPIC
diff --git a/sysdeps/sparc/nptl/Makefile b/sysdeps/sparc/nptl/Makefile
index 5372867dbd..81bddf688c 100644
--- a/sysdeps/sparc/nptl/Makefile
+++ b/sysdeps/sparc/nptl/Makefile
@@ -1,8 +1,3 @@
 ifeq ($(subdir),csu)
 gen-as-const-headers += tcb-offsets.sym
 endif
-
-ifeq ($(subdir),nptl)
-CPPFLAGS-pt-crti.S += -fPIC
-CPPFLAGS-crtn.S += -fPIC
-endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
index 14ada15a35..cebf7c6064 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.17 __errno_location F
+GLIBC_2.17 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile
index 92484bbe65..d7c7d7fc16 100644
--- a/sysdeps/unix/sysv/linux/alpha/Makefile
+++ b/sysdeps/unix/sysv/linux/alpha/Makefile
@@ -30,12 +30,6 @@ ifeq ($(subdir),math)
 libm-routines += multc3 divtc3
 endif   # math
 
-ifeq ($(subdir),nptl)
-# pull in __syscall_error routine, sigaction stubs.
-libpthread-routines += sysdep rt_sigaction
-libpthread-shared-only-routines += sysdep rt_sigaction
-endif
-
 ifeq ($(subdir),conform)
 # For bug 21260.
 conformtest-xfail-conds += alpha-linux
diff --git a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
index 47cbcf3baf..051caff7c0 100644
--- a/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.0 __errno_location F
+GLIBC_2.0 __libpthread_version_placeholder F
 GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/arc/libpthread.abilist b/sysdeps/unix/sysv/linux/arc/libpthread.abilist
index c4264810e6..cd90b49787 100644
--- a/sysdeps/unix/sysv/linux/arc/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arc/libpthread.abilist
@@ -1 +1 @@
-GLIBC_2.32 __errno_location F
+GLIBC_2.32 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile
index abdf01f00c..32db854cbd 100644
--- a/sysdeps/unix/sysv/linux/arm/Makefile
+++ b/sysdeps/unix/sysv/linux/arm/Makefile
@@ -26,11 +26,6 @@ librt-sysdep_routines += libc-do-syscall
 librt-shared-only-routines += libc-do-syscall
 endif
 
-ifeq ($(subdir),nptl)
-libpthread-sysdep_routines += libc-do-syscall
-libpthread-shared-only-routines += libc-do-syscall
-endif
-
 ifeq ($(subdir),resolv)
 libanl-sysdep_routines += libc-do-syscall
 libanl-shared-only-routines += libc-do-syscall
diff --git a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
index f8ebb4cae2..1774f414c6 100644
--- a/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/be/libpthread.abilist
@@ -4,5 +4,4 @@ GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
-GLIBC_2.4 __errno_location F
 GLIBC_2.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
index f8ebb4cae2..1774f414c6 100644
--- a/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/arm/le/libpthread.abilist
@@ -4,5 +4,4 @@ GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
-GLIBC_2.4 __errno_location F
 GLIBC_2.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/csky/libpthread.abilist b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
index f7649b87b2..8ce9efcbf8 100644
--- a/sysdeps/unix/sysv/linux/csky/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/csky/libpthread.abilist
@@ -1,3 +1,3 @@
-GLIBC_2.29 __errno_location F
+GLIBC_2.29 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
index f1adf37ff2..35b6df4615 100644
--- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist
@@ -1,7 +1,7 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.2 __errno_location F
+GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index da716e2c1b..26e0a8852b 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -18,11 +18,6 @@ ifeq ($(subdir),io)
 sysdep_routines += libc-do-syscall
 endif
 
-ifeq ($(subdir),nptl)
-libpthread-sysdep_routines += libc-do-syscall
-libpthread-shared-only-routines += libc-do-syscall
-endif
-
 ifeq ($(subdir),stdlib)
 gen-as-const-headers += ucontext_i.sym
 endif
@@ -36,12 +31,6 @@ CPPFLAGS-divdi3.c = -Din_divdi3_c
 endif
 endif
 
-ifeq ($(subdir),nptl)
-# pull in __syscall_error routine
-libpthread-routines += sysdep
-libpthread-shared-only-routines += sysdep
-endif
-
 ifeq ($(subdir),rt)
 # pull in __syscall_error routine
 librt-routines += sysdep
diff --git a/sysdeps/unix/sysv/linux/i386/libpthread.abilist b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
index 47cbcf3baf..051caff7c0 100644
--- a/sysdeps/unix/sysv/linux/i386/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.0 __errno_location F
+GLIBC_2.0 __libpthread_version_placeholder F
 GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
index f1adf37ff2..35b6df4615 100644
--- a/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libpthread.abilist
@@ -1,7 +1,7 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.2 __errno_location F
+GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
index f8ebb4cae2..1774f414c6 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
@@ -4,5 +4,4 @@ GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
-GLIBC_2.4 __errno_location F
 GLIBC_2.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
index 47cbcf3baf..051caff7c0 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.0 __errno_location F
+GLIBC_2.0 __libpthread_version_placeholder F
 GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/microblaze/Makefile b/sysdeps/unix/sysv/linux/microblaze/Makefile
index d178bc6f34..614553204f 100644
--- a/sysdeps/unix/sysv/linux/microblaze/Makefile
+++ b/sysdeps/unix/sysv/linux/microblaze/Makefile
@@ -1,9 +1,3 @@
 ifeq ($(subdir),resource)
 sysdep_routines += backtrace_linux
 endif
-
-ifeq ($(subdir),nptl)
-# pull in __syscall_error routine
-libpthread-routines += sysdep
-libpthread-shared-only-routines += sysdep
-endif
diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
index c99c8b026c..419561d3ce 100644
--- a/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/be/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.18 __errno_location F
+GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
index c99c8b026c..419561d3ce 100644
--- a/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/le/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.18 __errno_location F
+GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
index 2d0b9e3542..eac5591410 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.0 __errno_location F
+GLIBC_2.0 __libpthread_version_placeholder F
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
index 2d0b9e3542..eac5591410 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.0 __errno_location F
+GLIBC_2.0 __libpthread_version_placeholder F
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
index 4d8ff6a262..714dfd90aa 100644
--- a/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.21 __errno_location F
+GLIBC_2.21 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile
index 06f1328fab..733557ba13 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/sysdeps/unix/sysv/linux/powerpc/Makefile
@@ -25,8 +25,3 @@ tests += $(tests-static)
 tests += test-gettimebasefreq
 tests += test-powerpc-linux-sysconf
 endif
-
-ifeq ($(subdir),nptl)
-libpthread-routines += sysdep
-libpthread-shared-only-routines += sysdep
-endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
index e545bcc56c..5623c6a313 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.0 __errno_location F
+GLIBC_2.0 __libpthread_version_placeholder F
 GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
index e10c836946..3246752fdd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
@@ -2,7 +2,7 @@ GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
-GLIBC_2.3 __errno_location F
+GLIBC_2.3 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
 GLIBC_2.3.3 __libpthread_version_placeholder F
 GLIBC_2.3.4 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
index 14ada15a35..cebf7c6064 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.17 __errno_location F
+GLIBC_2.17 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
index 73188776b6..d8835698d8 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/libpthread.abilist
@@ -1 +1 @@
-GLIBC_2.33 __errno_location F
+GLIBC_2.33 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
index 35a6a20935..fb241212a5 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.27 __errno_location F
+GLIBC_2.27 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
 GLIBC_2.31 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
index ac212e942a..40ce2f1fbd 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.0 __errno_location F
+GLIBC_2.0 __libpthread_version_placeholder F
 GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
index e0feab34d5..08ef7c4283 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
@@ -2,7 +2,7 @@ GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.19 __libpthread_version_placeholder F
-GLIBC_2.2 __errno_location F
+GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
index f1adf37ff2..35b6df4615 100644
--- a/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/be/libpthread.abilist
@@ -1,7 +1,7 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.2 __errno_location F
+GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
index f1adf37ff2..35b6df4615 100644
--- a/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sh/le/libpthread.abilist
@@ -1,7 +1,7 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.2 __errno_location F
+GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile
index 1475039677..e0056c9413 100644
--- a/sysdeps/unix/sysv/linux/sparc/Makefile
+++ b/sysdeps/unix/sysv/linux/sparc/Makefile
@@ -14,9 +14,3 @@ endif
 ifeq ($(subdir),signal)
 sysdep_routines += sigreturn_stub
 endif
-
-ifeq ($(subdir),nptl)
-# pull in __syscall_error routine
-libpthread-routines += sysdep sigreturn_stub
-libpthread-shared-only-routines += sysdep sigreturn_stub
-endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
index 47cbcf3baf..051caff7c0 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.0 __errno_location F
+GLIBC_2.0 __libpthread_version_placeholder F
 GLIBC_2.1 __libpthread_version_placeholder F
 GLIBC_2.1.1 __libpthread_version_placeholder F
 GLIBC_2.1.2 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
index f1adf37ff2..35b6df4615 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
@@ -1,7 +1,7 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.2 __errno_location F
+GLIBC_2.2 __libpthread_version_placeholder F
 GLIBC_2.2.3 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
index ec4e3c0ecd..c94ae208cb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
@@ -1,7 +1,7 @@
 GLIBC_2.11 __libpthread_version_placeholder F
 GLIBC_2.12 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
-GLIBC_2.2.5 __errno_location F
+GLIBC_2.2.5 __libpthread_version_placeholder F
 GLIBC_2.2.6 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.3.2 __libpthread_version_placeholder F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
index cc6e073a11..38308e4ca7 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
@@ -1,4 +1,4 @@
-GLIBC_2.16 __errno_location F
+GLIBC_2.16 __libpthread_version_placeholder F
 GLIBC_2.18 __libpthread_version_placeholder F
 GLIBC_2.28 __libpthread_version_placeholder F
 GLIBC_2.30 __libpthread_version_placeholder F
-- 
2.31.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 7/8] nptl: Do not install libpthread.so and do not link tests with it
  2021-05-21 12:45 [PATCH v2 0/8] nptl: Complete libpthread move Florian Weimer
                   ` (5 preceding siblings ...)
  2021-05-21 12:46 ` [PATCH 6/8] nptl: Remove remaining code from libpthread Florian Weimer
@ 2021-05-21 12:46 ` 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
  7 siblings, 1 reply; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 12:46 UTC (permalink / raw)
  To: libc-alpha

Keep installing libpthread.a, so that -lpthread works.
---
 nptl/Makefile           | 30 +++++-------------------------
 sysdeps/nptl/Makeconfig |  8 ++++++--
 2 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/nptl/Makefile b/nptl/Makefile
index 64cd0dcbf6..52d1d193d9 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -204,12 +204,15 @@ routines = \
   unwind \
   vars \
 
-shared-only-routines = forward
 static-only-routines = pthread_atfork
-
 libpthread-routines = libpthread-compat
 libpthread-shared-only-routines = libpthread-compat
 
+# Pretend that libpthread.so is a linker script, so that the symbolic
+# link is not installed.
+install-lib-ldscripts = libpthread.so
+$(inst_libdir)/libpthread.so:
+
 # Since cancellation handling is in large parts handled using exceptions
 # we have to compile some files with exception handling enabled, some
 # even with asynchronous unwind tables.
@@ -374,8 +377,6 @@ else
 tests-printers-libs := $(static-thread-library)
 endif
 
-LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete
-
 tests += tst-cancelx7 tst-cancelx17
 
 ifeq ($(build-shared),yes)
@@ -469,7 +470,6 @@ ifeq (yes,$(build-shared))
 lib-noranlib: $(addprefix $(objpfx),$(extra-objs))
 endif
 
-
 # 'pthread_self' is a simple memory or register load.  Setting up the
 # stack frame is more work than the actual operation.  Disable the
 # frame creation entirely.  This will help applications which call the
@@ -548,35 +548,15 @@ else
 librt = $(common-objpfx)rt/librt.a
 endif
 
-# `make check' sometimes triggers a rebuild of librt.so using this Makefile,
-# which ignores librt's dependence on libpthread
-$(common-objpfx)rt/librt.so: $(shared-thread-library)
-
 $(objpfx)tst-cancel17: $(librt)
 $(objpfx)tst-cancelx17: $(librt)
 
 LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++
 LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
 
-# Make sure we link with the thread library.
 ifeq ($(build-shared),yes)
-$(addprefix $(objpfx), \
-  $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
-    $(tests-nolibpthread), \
-    $(tests) $(tests-internal) $(xtests) $(test-srcs) $(tests-container))): \
-	$(objpfx)libpthread.so
 $(objpfx)tst-unload: $(libdl)
-# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
-# since otherwise libpthread.so comes before libc.so when linking.
-$(addprefix $(objpfx), $(tests-reverse)): \
-  $(objpfx)../libc.so $(objpfx)libpthread.so
-$(objpfx)../libc.so: $(common-objpfx)libc.so ;
-$(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(objpfx)libpthread.a
-else
-$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
-endif
 
-ifeq ($(build-shared),yes)
 generated += multidir.mk tst-tls6.out
 endif
 
diff --git a/sysdeps/nptl/Makeconfig b/sysdeps/nptl/Makeconfig
index 8757ec868b..8a9407925c 100644
--- a/sysdeps/nptl/Makeconfig
+++ b/sysdeps/nptl/Makeconfig
@@ -21,7 +21,11 @@
 
 have-thread-library = yes
 
-shared-thread-library = $(common-objpfx)nptl/libpthread.so
-static-thread-library = $(common-objpfx)nptl/libpthread.a
+# The thread library is integrated.
+shared-thread-library =
+static-thread-library =
 
+# Some tests need this to load their own test objects, and system
+# libraries used by memusagestat need to link against the empty
+# libpthread.so.0, not the (potentially non-empty) system version.
 rpath-dirs += nptl
-- 
2.31.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 8/8] Linux: Remove remaining references to $(shared-thread-library)
  2021-05-21 12:45 [PATCH v2 0/8] nptl: Complete libpthread move Florian Weimer
                   ` (6 preceding siblings ...)
  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-21 12:46 ` Florian Weimer
  2021-05-24 18:27   ` Adhemerval Zanella
  7 siblings, 1 reply; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 12:46 UTC (permalink / raw)
  To: libc-alpha

Since the variable expands to nothing under Linux, it is no longer
necessary to clutter the makefiles with it.
---
 nptl/Makefile                         | 21 +++++++--------------
 sysdeps/mips/Makefile                 |  2 --
 sysdeps/unix/sysv/linux/Makefile      |  6 ------
 sysdeps/unix/sysv/linux/i386/Makefile |  1 -
 4 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/nptl/Makefile b/nptl/Makefile
index 52d1d193d9..060d6eebd6 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -371,12 +371,6 @@ CPPFLAGS-tst-pthread-gdb-attach-static.c := \
 # were launched with an explicit ld.so invocation.
 tst-pthread-gdb-attach-no-pie = yes
 
-ifeq ($(build-shared),yes)
-tests-printers-libs := $(shared-thread-library)
-else
-tests-printers-libs := $(static-thread-library)
-endif
-
 tests += tst-cancelx7 tst-cancelx17
 
 ifeq ($(build-shared),yes)
@@ -501,7 +495,7 @@ $(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out
 	$(evaluate-test)
 generated += tst-stack3-mem.out tst-stack3.mtrace
 
-$(objpfx)tst-stack4: $(libdl) $(shared-thread-library)
+$(objpfx)tst-stack4: $(libdl)
 tst-stack4mod.sos=$(shell for i in 0 1 2 3 4 5 6 7 8 9 10 \
 				   11 12 13 14 15 16 17 18 19; do \
 			    for j in 0 1 2 3 4 5 6 7 8 9 10 \
@@ -514,19 +508,18 @@ $(tst-stack4mod.sos): $(objpfx)tst-stack4mod.so
 clean:
 	rm -f $(tst-stack4mod.sos)
 
-$(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o $(shared-thread-library)
-$(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o $(shared-thread-library)
+$(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o
+$(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o
 
-$(objpfx)tst-tls3: $(libdl) $(shared-thread-library)
+$(objpfx)tst-tls3: $(libdl)
 LDFLAGS-tst-tls3 = -rdynamic
 $(objpfx)tst-tls3.out: $(objpfx)tst-tls3mod.so
-$(objpfx)tst-tls3mod.so: $(shared-thread-library)
 
-$(objpfx)tst-tls3-malloc: $(libdl) $(shared-thread-library)
+$(objpfx)tst-tls3-malloc: $(libdl)
 LDFLAGS-tst-tls3-malloc = -rdynamic
 $(objpfx)tst-tls3-malloc.out: $(objpfx)tst-tls3mod.so
 
-$(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library)
+$(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so
 LDFLAGS-tst-tls5 = -Wl,--no-as-needed
 LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
 
@@ -540,7 +533,7 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
 	$(evaluate-test)
 endif
 
-$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
+$(objpfx)tst-dlsym1: $(libdl)
 
 ifeq (yes,$(build-shared))
 librt = $(common-objpfx)rt/librt.so
diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile
index 19e6a57622..150518bc6d 100644
--- a/sysdeps/mips/Makefile
+++ b/sysdeps/mips/Makefile
@@ -72,8 +72,6 @@ endif
 ifeq ($(mips-mode-switch),yes)
 ifeq ($(o32-fpabi),xx)
 tests += tst-mode-switch-1 tst-mode-switch-2 tst-mode-switch-3
-$(objpfx)tst-mode-switch-1: $(shared-thread-library)
-$(objpfx)tst-mode-switch-2: $(shared-thread-library)
 endif
 endif
 endif
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index fb155cf856..e9566e028a 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -179,8 +179,6 @@ $(objpfx)tst-glibcsyscalls.out: \
 # Separate object file for access to the constant from the UAPI header.
 $(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o
 
-$(objpfx)tst-pkey: $(shared-thread-library)
-
 tests-special += $(objpfx)tst-mman-consts.out
 $(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py
 	$(sysdeps-linux-python) \
@@ -189,10 +187,6 @@ $(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py
 	  < /dev/null > $@ 2>&1; $(evaluate-test)
 $(objpfx)tst-mman-consts.out: $(sysdeps-linux-python-deps)
 
-$(objpfx)tst-gettid: $(shared-thread-library)
-$(objpfx)tst-gettid-kill: $(shared-thread-library)
-$(objpfx)tst-tgkill: $(shared-thread-library)
-
 endif # $(subdir) == misc
 
 ifeq ($(subdir),time)
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 26e0a8852b..abd0009d58 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -5,7 +5,6 @@ ifeq ($(subdir),misc)
 sysdep_routines += ioperm iopl vm86
 
 tests += tst-bz21269
-$(objpfx)tst-bz21269: $(shared-thread-library)
 endif
 
 ifeq ($(subdir),elf)
-- 
2.31.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/8] nptl: Perform signal initialization upon pthread_create
  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
  0 siblings, 1 reply; 15+ messages in thread
From: Adhemerval Zanella @ 2021-05-21 20:03 UTC (permalink / raw)
  To: Florian Weimer, libc-alpha



On 21/05/2021 09:45, Florian Weimer via Libc-alpha wrote:
> Install signal handlers and unblock signals before pthread_create
> creates the first thread.
> 
> create_thread in sysdeps/unix/sysv/linux/createthread.c can send
> SIGCANCEL to the current thread, so the SIGCANCEL handler is currently
> needed even if pthread_cancel is never called.  (The way timer_create
> uses SIGCANCEL does not need a signal handler; both SIG_DFL and SIG_IGN
> dispositions should work.)

LGTM, thanks.  I have only a question about the PTHREAD_STATIC_FN_REQUIRE
addition.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  nptl/Versions         |  5 ++-
>  nptl/nptl-init.c      | 75 ------------------------------------
>  nptl/pthreadP.h       |  6 +++
>  nptl/pthread_cancel.c | 88 ++++++++++++++++++++++++++++++++++++++-----
>  nptl/pthread_create.c | 45 +++++++++++++++++++++-
>  5 files changed, 131 insertions(+), 88 deletions(-)
> 
> diff --git a/nptl/Versions b/nptl/Versions
> index e7883cbb49..d96b830d05 100644
> --- a/nptl/Versions
> +++ b/nptl/Versions
> @@ -367,8 +367,6 @@ libc {
>      tss_set;
>    }
>    GLIBC_PRIVATE {
> -     __nptl_create_event;
> -     __nptl_death_event;
>      __default_pthread_attr;
>      __default_pthread_attr_lock;
>      __futex_abstimed_wait64;
> @@ -386,11 +384,14 @@ libc {
>      __lll_trylock_elision;
>      __lll_unlock_elision;
>      __mutex_aconf;
> +    __nptl_create_event;
>      __nptl_deallocate_stack;
>      __nptl_deallocate_tsd;
> +    __nptl_death_event;
>      __nptl_free_tcb;
>      __nptl_nthreads;
>      __nptl_setxid_sighandler;
> +    __nptl_sigcancel_handler;
>      __nptl_stack_list_add;
>      __nptl_stack_list_del;
>      __pthread_attr_copy;

Ok.

> diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
> index f4b86fbfaf..bc4831ac89 100644
> --- a/nptl/nptl-init.c
> +++ b/nptl/nptl-init.c
> @@ -44,84 +44,9 @@ size_t __static_tls_align_m1;
>  /* Version of the library, used in libthread_db to detect mismatches.  */
>  static const char nptl_version[] __attribute_used__ = VERSION;
>  
> -/* For asynchronous cancellation we use a signal.  This is the handler.  */
> -static void
> -sigcancel_handler (int sig, siginfo_t *si, void *ctx)
> -{
> -  /* Safety check.  It would be possible to call this function for
> -     other signals and send a signal from another process.  This is not
> -     correct and might even be a security problem.  Try to catch as
> -     many incorrect invocations as possible.  */
> -  if (sig != SIGCANCEL
> -      || si->si_pid != __getpid()
> -      || si->si_code != SI_TKILL)
> -    return;
> -
> -  struct pthread *self = THREAD_SELF;
> -
> -  int oldval = THREAD_GETMEM (self, cancelhandling);
> -  while (1)
> -    {
> -      /* We are canceled now.  When canceled by another thread this flag
> -	 is already set but if the signal is directly send (internally or
> -	 from another process) is has to be done here.  */
> -      int newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
> -
> -      if (oldval == newval || (oldval & EXITING_BITMASK) != 0)
> -	/* Already canceled or exiting.  */
> -	break;
> -
> -      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
> -					      oldval);
> -      if (curval == oldval)
> -	{
> -	  /* Set the return value.  */
> -	  THREAD_SETMEM (self, result, PTHREAD_CANCELED);
> -
> -	  /* Make sure asynchronous cancellation is still enabled.  */
> -	  if ((newval & CANCELTYPE_BITMASK) != 0)
> -	    /* Run the registered destructors and terminate the thread.  */
> -	    __do_cancel ();
> -
> -	  break;
> -	}
> -
> -      oldval = curval;
> -    }
> -}
> -
> -
> -/* When using __thread for this, we do it in libc so as not
> -   to give libpthread its own TLS segment just for this.  */
> -extern void **__libc_dl_error_tsd (void) __attribute__ ((const));
> -
> -
>  void
>  __pthread_initialize_minimal_internal (void)
>  {
> -  struct sigaction sa;
> -  __sigemptyset (&sa.sa_mask);
> -
> -  /* Install the cancellation signal handler.  If for some reason we
> -     cannot install the handler we do not abort.  Maybe we should, but
> -     it is only asynchronous cancellation which is affected.  */
> -  sa.sa_sigaction = sigcancel_handler;
> -  sa.sa_flags = SA_SIGINFO;
> -  (void) __libc_sigaction (SIGCANCEL, &sa, NULL);
> -
> -  /* Install the handle to change the threads' uid/gid.  */
> -  sa.sa_sigaction = __nptl_setxid_sighandler;
> -  sa.sa_flags = SA_SIGINFO | SA_RESTART;
> -  (void) __libc_sigaction (SIGSETXID, &sa, NULL);
> -
> -  /* The parent process might have left the signals blocked.  Just in
> -     case, unblock it.  We reuse the signal mask in the sigaction
> -     structure.  It is already cleared.  */
> -  __sigaddset (&sa.sa_mask, SIGCANCEL);
> -  __sigaddset (&sa.sa_mask, SIGSETXID);
> -  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sa.sa_mask,
> -			 NULL, __NSIG_BYTES);
> -
>    /* Get the size of the static and alignment requirements for the TLS
>       block.  */
>    size_t static_tls_align;

Ok.

> diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
> index f93806e540..497c2ad3d9 100644
> --- a/nptl/pthreadP.h
> +++ b/nptl/pthreadP.h
> @@ -571,6 +571,12 @@ libc_hidden_proto (__pthread_attr_setsigmask_internal)
>  extern __typeof (pthread_attr_getsigmask_np) __pthread_attr_getsigmask_np;
>  libc_hidden_proto (__pthread_attr_getsigmask_np)
>  
> +/* The cancellation signal handler defined alongside with
> +   pthread_cancel.  This is included in statically linked binaries
> +   only if pthread_cancel is linked in.  */
> +void __nptl_sigcancel_handler (int sig, siginfo_t *si, void *ctx);
> +libc_hidden_proto (__nptl_sigcancel_handler)
> +
>  /* Special versions which use non-exported functions.  */
>  extern void __pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer,
>  				    void (*routine) (void *), void *arg);

Ok.

> diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
> index e4ad602900..802c691874 100644
> --- a/nptl/pthread_cancel.c
> +++ b/nptl/pthread_cancel.c
> @@ -26,6 +26,63 @@
>  #include <unwind-link.h>
>  #include <stdio.h>
>  #include <gnu/lib-names.h>
> +#include <sys/single_threaded.h>
> +
> +/* For asynchronous cancellation we use a signal.  This is the core
> +   logic of the signal handler.  */
> +static void
> +sigcancel_handler (void)
> +{
> +  struct pthread *self = THREAD_SELF;
> +
> +  int oldval = THREAD_GETMEM (self, cancelhandling);
> +  while (1)
> +    {
> +      /* We are canceled now.  When canceled by another thread this flag
> +	 is already set but if the signal is directly send (internally or
> +	 from another process) is has to be done here.  */
> +      int newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
> +
> +      if (oldval == newval || (oldval & EXITING_BITMASK) != 0)
> +	/* Already canceled or exiting.  */
> +	break;
> +
> +      int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,
> +					      oldval);
> +      if (curval == oldval)
> +	{
> +	  /* Set the return value.  */
> +	  THREAD_SETMEM (self, result, PTHREAD_CANCELED);
> +
> +	  /* Make sure asynchronous cancellation is still enabled.  */
> +	  if ((newval & CANCELTYPE_BITMASK) != 0)
> +	    /* Run the registered destructors and terminate the thread.  */
> +	    __do_cancel ();
> +
> +	  break;
> +	}
> +
> +      oldval = curval;
> +    }
> +}
> +
> +/* This is the actually installed SIGCANCEL handler.  It adds some
> +   safety checks before performing the cancellation.  */
> +void
> +__nptl_sigcancel_handler (int sig, siginfo_t *si, void *ctx)
> +{
> +  /* Safety check.  It would be possible to call this function for
> +     other signals and send a signal from another process.  This is not
> +     correct and might even be a security problem.  Try to catch as
> +     many incorrect invocations as possible.  */
> +  if (sig != SIGCANCEL
> +      || si->si_pid != __getpid()
> +      || si->si_code != SI_TKILL)
> +    return;
> +
> +  sigcancel_handler ();
> +}
> +libc_hidden_def (__nptl_sigcancel_handler)
>  
>  int
>  __pthread_cancel (pthread_t th)

Ok.

> @@ -72,14 +129,23 @@ __pthread_cancel (pthread_t th)
>  						    oldval))
>  	    goto again;
>  
> -	  /* The cancellation handler will take care of marking the
> -	     thread as canceled.  */
> -	  pid_t pid = __getpid ();
> -
> -	  int val = INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid,
> -					   SIGCANCEL);
> -	  if (INTERNAL_SYSCALL_ERROR_P (val))
> -	    result = INTERNAL_SYSCALL_ERRNO (val);
> +	  if (pd == THREAD_SELF)
> +	    /* This is not merely an optimization: An application may
> +	       call pthread_cancel (pthread_self ()) without calling
> +	       pthread_create, so the signal handler may not have been
> +	       set up for a self-cancel.  */
> +	    sigcancel_handler ();
> +	  else
> +	    {
> +	      /* The cancellation handler will take care of marking the
> +		 thread as canceled.  */
> +	      pid_t pid = __getpid ();
> +
> +	      int val = INTERNAL_SYSCALL_CALL (tgkill, pid, pd->tid,
> +					       SIGCANCEL);
> +	      if (INTERNAL_SYSCALL_ERROR_P (val))
> +		result = INTERNAL_SYSCALL_ERRNO (val);
> +	    }
>  
>  	  break;
>  	}

Ok.

> @@ -106,4 +172,8 @@ versioned_symbol (libc, __pthread_cancel, pthread_cancel, GLIBC_2_34);
>  compat_symbol (libpthread, __pthread_cancel, pthread_cancel, GLIBC_2_0);
>  #endif
>  
> -PTHREAD_STATIC_FN_REQUIRE (__pthread_create)
> +/* Ensure that the unwinder is always linked in (the __pthread_unwind
> +   reference from __do_cancel is weak).  Use ___pthread_unwind_next
> +   (three underscores) to produce a strong reference to the same
> +   file.  */
> +PTHREAD_STATIC_FN_REQUIRE (___pthread_unwind_next)

Why __pthread_unwind is marked as weak now? Would be simpler to unmark
is as weak and avoid the PTHREAD_STATIC_FN_REQUIRE?

> diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
> index 770656453d..772b5efcc6 100644
> --- a/nptl/pthread_create.c
> +++ b/nptl/pthread_create.c
> @@ -56,6 +56,43 @@ static struct rtld_global *__nptl_rtld_global __attribute_used__
>    = &_rtld_global;
>  #endif
>  
> +/* This performs the initialization necessary when going from
> +   single-threaded to multi-threaded mode for the first time.  */
> +static void
> +late_init (void)
> +{
> +  struct sigaction sa;
> +  __sigemptyset (&sa.sa_mask);
> +
> +  /* Install the cancellation signal handler (in static builds only if
> +     pthread_cancel has been linked in).  If for some reason we cannot
> +     install the handler we do not abort.  Maybe we should, but it is
> +     only asynchronous cancellation which is affected.  */
> +#ifndef SHARED
> +  extern __typeof (__nptl_sigcancel_handler) __nptl_sigcancel_handler
> +    __attribute__ ((weak));
> +  if (__nptl_sigcancel_handler != NULL)
> +#endif
> +    {
> +      sa.sa_sigaction = __nptl_sigcancel_handler;
> +      sa.sa_flags = SA_SIGINFO;
> +      (void) __libc_sigaction (SIGCANCEL, &sa, NULL);
> +    }
> +
> +  /* Install the handle to change the threads' uid/gid.  */
> +  sa.sa_sigaction = __nptl_setxid_sighandler;
> +  sa.sa_flags = SA_SIGINFO | SA_RESTART;
> +  (void) __libc_sigaction (SIGSETXID, &sa, NULL);
> +
> +  /* The parent process might have left the signals blocked.  Just in
> +     case, unblock it.  We reuse the signal mask in the sigaction
> +     structure.  It is already cleared.  */
> +  __sigaddset (&sa.sa_mask, SIGCANCEL);
> +  __sigaddset (&sa.sa_mask, SIGSETXID);
> +  INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sa.sa_mask,
> +			 NULL, __NSIG_BYTES);
> +}
> +
>  /* Code to allocate and deallocate a stack.  */
>  #include "allocatestack.c"
>  

Ok.

> @@ -459,9 +496,13 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
>  {
>    STACK_VARIABLES;
>  
> -  /* Avoid a data race in the multi-threaded case.  */
> +  /* Avoid a data race in the multi-threaded case, and call the
> +     deferred initialization only once.  */
>    if (__libc_single_threaded)
> -    __libc_single_threaded = 0;
> +    {
> +      late_init ();
> +      __libc_single_threaded = 0;
> +    }
>  
>    const struct pthread_attr *iattr = (struct pthread_attr *) attr;
>    union pthread_attr_transparent default_attr;
> 

Ok.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 4/8] elf: Use custom NODELETE DSO for tst-dlopenfail, tst-dlopenfail-2
  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
  0 siblings, 0 replies; 15+ messages in thread
From: Adhemerval Zanella @ 2021-05-21 20:11 UTC (permalink / raw)
  To: Florian Weimer, libc-alpha



On 21/05/2021 09:45, Florian Weimer via Libc-alpha wrote:
> Once libpthread is empty and no longer marked NODELETE, it no longer
> can be used for testing.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
> v2: Restrict the use of xdlopen/xdlsym, reverting to what was there before.
> 
>  elf/Makefile                 | 11 +++++++--
>  elf/tst-dlopenfail-2.c       |  5 +---
>  elf/tst-dlopenfail.c         | 46 +++++++++++++++---------------------
>  elf/tst-dlopenfailmod2.c     |  6 ++---
>  elf/tst-dlopenfailnodelmod.c | 29 +++++++++++++++++++++++
>  5 files changed, 61 insertions(+), 36 deletions(-)
>  create mode 100644 elf/tst-dlopenfailnodelmod.c
> 
> diff --git a/elf/Makefile b/elf/Makefile
> index 5e809dbfaa..834ec858a8 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -334,7 +334,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
>  		tst-auditmanymod7 tst-auditmanymod8 tst-auditmanymod9 \
>  		tst-initlazyfailmod tst-finilazyfailmod \
>  		tst-dlopenfailmod1 tst-dlopenfaillinkmod tst-dlopenfailmod2 \
> -		tst-dlopenfailmod3 tst-ldconfig-ld-mod \
> +		tst-dlopenfailmod3 tst-dlopenfailnodelmod tst-ldconfig-ld-mod \
>  		tst-filterobj-flt tst-filterobj-aux tst-filterobj-filtee \
>  		tst-auditlogmod-1 tst-auditlogmod-2 tst-auditlogmod-3 \
>  		tst-single_threaded-mod1 tst-single_threaded-mod2 \
> @@ -1733,11 +1733,18 @@ LDFLAGS-tst-dlopenfailmod1.so = -Wl,--no-as-needed
>  $(objpfx)tst-dlopenfailmod1.so: \
>    $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so
>  LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so
> -$(objpfx)tst-dlopenfailmod2.so: $(shared-thread-library)
> +$(objpfx)tst-dlopenfailmod2.so: $(objpfx)tst-dlopenfailnodelmod.so
>  $(objpfx)tst-dlopenfail-2: $(libdl)
>  $(objpfx)tst-dlopenfail-2.out: \
>    $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so \
>    $(objpfx)tst-dlopenfailmod3.so
> +# tst-dlopenfailnodelmod.so emulates how libpthread was linked.
> +$(objpfx)tst-dlopenfailnodelmod.so: $(libsupport)
> +LDFLAGS-tst-dlopenfailnodelmod.so = \
> +  -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
> +# tst-dlopenfail should export the libsupport symbols, so that
> +# tst-dlopenfailnodelmod.so uses them for error reporting.
> +LDFLAGS-tst-dlopenfail = -Wl,-E
>  
>  $(objpfx)tst-dlopen-nodelete-reloc: $(libdl)
>  $(objpfx)tst-dlopen-nodelete-reloc.out: \
> diff --git a/elf/tst-dlopenfail-2.c b/elf/tst-dlopenfail-2.c
> index 50eed81cb0..168c4b2c7f 100644
> --- a/elf/tst-dlopenfail-2.c
> +++ b/elf/tst-dlopenfail-2.c
> @@ -28,10 +28,7 @@
>  static int
>  do_test (void)
>  {
> -  /* This test uses libpthread as the canonical NODELETE module.  If
> -     libpthread is no longer NODELETE because it has been merged into
> -     libc, the test needs to be updated.  */
> -  TEST_VERIFY (dlsym (NULL, "pthread_create") == NULL);
> +  TEST_VERIFY (dlsym (NULL, "no_delete_mod_function") == NULL);
>  
>    /* This is expected to fail because of the missing dependency.  */
>    puts ("info: attempting to load tst-dlopenfailmod1.so");
> diff --git a/elf/tst-dlopenfail.c b/elf/tst-dlopenfail.c
> index db2b41f9b5..edf84e8259 100644
> --- a/elf/tst-dlopenfail.c
> +++ b/elf/tst-dlopenfail.c
> @@ -18,7 +18,6 @@
>  
>  #include <dlfcn.h>
>  #include <errno.h>
> -#include <gnu/lib-names.h>
>  #include <stddef.h>
>  #include <stdio.h>
>  #include <string.h>
> @@ -28,10 +27,7 @@
>  static int
>  do_test (void)
>  {
> -  /* This test uses libpthread as the canonical NODELETE module.  If
> -     libpthread is no longer NODELETE because it has been merged into
> -     libc, the test needs to be updated.  */
> -  TEST_VERIFY (dlsym (NULL, "pthread_create") == NULL);
> +  TEST_VERIFY (dlsym (NULL, "no_delete_mod_function") == NULL);
>  
>    /* This is expected to fail because of the missing dependency.  */
>    puts ("info: attempting to load tst-dlopenfailmod1.so");
> @@ -42,36 +38,32 @@ do_test (void)
>                         " cannot open shared object file:"
>                         " No such file or directory");
>  
> -  /* Do not probe for the presence of libpthread at this point because
> -     that might trigger relocation if bug 20839 is present, obscuring
> -     a subsequent crash.  */
> +  /* Do not probe for the presence of the tst-dlopenfailnodelmod.so at
> +     this point because that might trigger relocation if bug 20839 is
> +     present, obscuring a subsequent crash.  */
>  
>    /* This is expected to succeed.  */
>    puts ("info: loading tst-dlopenfailmod2.so");
>    void *handle = xdlopen ("tst-dlopenfailmod2.so", RTLD_NOW);
>    xdlclose (handle);
>  
> -  /* libpthread should remain loaded.  */
> -  TEST_VERIFY (dlopen (LIBPTHREAD_SO, RTLD_LAZY | RTLD_NOLOAD) != NULL);
> -  TEST_VERIFY (dlsym (NULL, "pthread_create") == NULL);
> +  /* The NODELETE module should remain loaded.  */
> +  TEST_VERIFY (dlopen ("tst-dlopenfailnodelmod.so", RTLD_LAZY | RTLD_NOLOAD)
> +               != NULL);
> +  /* But the symbol is not in the global scope.  */
> +  TEST_VERIFY (dlsym (NULL, "no_delete_mod_function") == NULL);
>  
> -  /* We can make libpthread global, and then the symbol should become
> -     available.  */
> -  TEST_VERIFY (dlopen (LIBPTHREAD_SO, RTLD_LAZY | RTLD_GLOBAL) != NULL);
> -  TEST_VERIFY (dlsym (NULL, "pthread_create") != NULL);
> +  /* We can make tst-dlopenfailnodelmod.so global, and then the symbol
> +     should become available.  */
> +  TEST_VERIFY (dlopen ("tst-dlopenfailnodelmod.so", RTLD_LAZY | RTLD_GLOBAL)
> +               != NULL);
> +  void (*no_delete_mod_function) (void)
> +    = dlsym (NULL, "no_delete_mod_function");
> +  TEST_VERIFY_EXIT (no_delete_mod_function != NULL);
>  
> -  /* sem_open is sufficiently complex to depend on relocations.  */
> -  void *(*sem_open_ptr) (const char *, int flag, ...)
> -    = dlsym (NULL, "sem_open");
> -  if (sem_open_ptr == NULL)
> -    /* Hurd does not implement sem_open.  */
> -    puts ("warning: sem_open not found, further testing not possible");
> -  else
> -    {
> -      errno = 0;
> -      TEST_VERIFY (sem_open_ptr ("/", 0) == NULL);
> -      TEST_COMPARE (errno, EINVAL);
> -    }
> +  /* Hopefully, no_delete_mod_function is sufficiently complex to
> +     depend on relocations.  */
> +  no_delete_mod_function ();
>  
>    return 0;
>  }
> diff --git a/elf/tst-dlopenfailmod2.c b/elf/tst-dlopenfailmod2.c
> index cd6f9cf56b..ed353f9a3c 100644
> --- a/elf/tst-dlopenfailmod2.c
> +++ b/elf/tst-dlopenfailmod2.c
> @@ -16,11 +16,11 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <pthread.h>
>  #include <stdio.h>
>  
> -/* Force linking against libpthread.  */
> -void *pthread_create_reference = pthread_create;
> +/* Force linking against tst-dlopenfailnodelmod.so.  */
> +void no_delete_mod_function (void);
> +void *function_reference = no_delete_mod_function;
>  
>  static void __attribute__ ((constructor))
>  init (void)
> diff --git a/elf/tst-dlopenfailnodelmod.c b/elf/tst-dlopenfailnodelmod.c
> new file mode 100644
> index 0000000000..c4347b7591
> --- /dev/null
> +++ b/elf/tst-dlopenfailnodelmod.c
> @@ -0,0 +1,29 @@
> +/* NODELETE module for tst-dlopenfail, tst-dlopenfail-2.
> +   Copyright (C) 2021 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <support/check.h>
> +
> +/* Introduce some relocation dependencies.  */
> +const char test_string[] = "test string";
> +const char *test_string_ptr = test_string;
> +
> +void
> +no_delete_mod_function (void)
> +{
> +  TEST_COMPARE_STRING (test_string, test_string_ptr);
> +}
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/8] nptl: Perform signal initialization upon pthread_create
  2021-05-21 20:03   ` Adhemerval Zanella
@ 2021-05-21 20:15     ` Florian Weimer
  2021-05-21 20:23       ` Adhemerval Zanella
  0 siblings, 1 reply; 15+ messages in thread
From: Florian Weimer @ 2021-05-21 20:15 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

* Adhemerval Zanella:

>> @@ -106,4 +172,8 @@ versioned_symbol (libc, __pthread_cancel, pthread_cancel, GLIBC_2_34);
>>  compat_symbol (libpthread, __pthread_cancel, pthread_cancel, GLIBC_2_0);
>>  #endif
>>  
>> -PTHREAD_STATIC_FN_REQUIRE (__pthread_create)
>> +/* Ensure that the unwinder is always linked in (the __pthread_unwind
>> +   reference from __do_cancel is weak).  Use ___pthread_unwind_next
>> +   (three underscores) to produce a strong reference to the same
>> +   file.  */
>> +PTHREAD_STATIC_FN_REQUIRE (___pthread_unwind_next)
>
> Why __pthread_unwind is marked as weak now? Would be simpler to unmark
> is as weak and avoid the PTHREAD_STATIC_FN_REQUIRE?

It's related to the compiled-in cancellation points.  The references to
__pthread_enable_asynccancel are strong, and that disassembles to:

0000000000000000 <__pthread_enable_asynccancel>:
   0:	mov    %fs:0x10,%rcx
   9:	mov    %fs:0x308,%r8d
  12:	mov    %r8d,%edx
  15:	or     $0x2,%edx
  18:	cmp    %edx,%r8d
  1b:	je     35 <__pthread_enable_asynccancel+0x35>
  1d:	mov    %r8d,%eax
  20:	lock cmpxchg %edx,0x308(%rcx)
  28:	cmp    %eax,%r8d
  2b:	jne    40 <__pthread_enable_asynccancel+0x40>
  2d:	and    $0xffffffbb,%edx
  30:	cmp    $0xa,%edx
  33:	je     45 <__pthread_enable_asynccancel+0x45>
  35:	mov    %r8d,%eax
  38:	retq   
  39:	nopl   0x0(%rax)
  40:	mov    %eax,%r8d
  43:	jmp    12 <__pthread_enable_asynccancel+0x12>
  45:	push   %rax
  46:	movq   $0xffffffffffffffff,%fs:0x630
  53:	mov    %fs:0x10,%rax
  5c:	lock orl $0x10,0x308(%rax)
  64:	mov    %fs:0x300,%rdi
  6d:	callq  72 <__pthread_enable_asynccancel+0x72>
			6e: R_X86_64_PLT32	__pthread_unwind-0x4
  72:	data16 nopw %cs:0x0(%rax,%rax,1)
  7d:	nopl   (%rax)

And the unwind reference is weak:

   17: 0000000000000000      0 NOTYPE  WEAK   HIDDEN     UNDEF __pthread_unwind

There's no address check because the cancellation state in the TCB can
only change if pthread_cancel is linked in, and that really should pull
in the unwinder, too.  That's why I added the PTHREAD_STATIC_FN_REQUIRE.
Without it, I think some of the existing tests will fail (the
pthread_create PTHREAD_STATIC_FN_REQUIREs are apparently not quite
correct).

I think it's always been this way, so that the unwinder is optional in
static links (in theory, in practice it is still pulled in by the bits
that are compiled with -fexceptions due to the _Unwind_Resume construct,
hence the need for elf/static-stubs.c).

Thanks,
Florian


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/8] nptl: Perform signal initialization upon pthread_create
  2021-05-21 20:15     ` Florian Weimer
@ 2021-05-21 20:23       ` Adhemerval Zanella
  0 siblings, 0 replies; 15+ messages in thread
From: Adhemerval Zanella @ 2021-05-21 20:23 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha



On 21/05/2021 17:15, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>>> @@ -106,4 +172,8 @@ versioned_symbol (libc, __pthread_cancel, pthread_cancel, GLIBC_2_34);
>>>  compat_symbol (libpthread, __pthread_cancel, pthread_cancel, GLIBC_2_0);
>>>  #endif
>>>  
>>> -PTHREAD_STATIC_FN_REQUIRE (__pthread_create)
>>> +/* Ensure that the unwinder is always linked in (the __pthread_unwind
>>> +   reference from __do_cancel is weak).  Use ___pthread_unwind_next
>>> +   (three underscores) to produce a strong reference to the same
>>> +   file.  */
>>> +PTHREAD_STATIC_FN_REQUIRE (___pthread_unwind_next)
>>
>> Why __pthread_unwind is marked as weak now? Would be simpler to unmark
>> is as weak and avoid the PTHREAD_STATIC_FN_REQUIRE?
> 
> It's related to the compiled-in cancellation points.  The references to
> __pthread_enable_asynccancel are strong, and that disassembles to:
> 
> 0000000000000000 <__pthread_enable_asynccancel>:
>    0:	mov    %fs:0x10,%rcx
>    9:	mov    %fs:0x308,%r8d
>   12:	mov    %r8d,%edx
>   15:	or     $0x2,%edx
>   18:	cmp    %edx,%r8d
>   1b:	je     35 <__pthread_enable_asynccancel+0x35>
>   1d:	mov    %r8d,%eax
>   20:	lock cmpxchg %edx,0x308(%rcx)
>   28:	cmp    %eax,%r8d
>   2b:	jne    40 <__pthread_enable_asynccancel+0x40>
>   2d:	and    $0xffffffbb,%edx
>   30:	cmp    $0xa,%edx
>   33:	je     45 <__pthread_enable_asynccancel+0x45>
>   35:	mov    %r8d,%eax
>   38:	retq   
>   39:	nopl   0x0(%rax)
>   40:	mov    %eax,%r8d
>   43:	jmp    12 <__pthread_enable_asynccancel+0x12>
>   45:	push   %rax
>   46:	movq   $0xffffffffffffffff,%fs:0x630
>   53:	mov    %fs:0x10,%rax
>   5c:	lock orl $0x10,0x308(%rax)
>   64:	mov    %fs:0x300,%rdi
>   6d:	callq  72 <__pthread_enable_asynccancel+0x72>
> 			6e: R_X86_64_PLT32	__pthread_unwind-0x4
>   72:	data16 nopw %cs:0x0(%rax,%rax,1)
>   7d:	nopl   (%rax)
> 
> And the unwind reference is weak:
> 
>    17: 0000000000000000      0 NOTYPE  WEAK   HIDDEN     UNDEF __pthread_unwind
> 
> There's no address check because the cancellation state in the TCB can
> only change if pthread_cancel is linked in, and that really should pull
> in the unwinder, too.  That's why I added the PTHREAD_STATIC_FN_REQUIRE.
> Without it, I think some of the existing tests will fail (the
> pthread_create PTHREAD_STATIC_FN_REQUIREs are apparently not quite
> correct).
> 
> I think it's always been this way, so that the unwinder is optional in
> static links (in theory, in practice it is still pulled in by the bits
> that are compiled with -fexceptions due to the _Unwind_Resume construct,
> hence the need for elf/static-stubs.c).

Right, it does seem unnecessary to pull the unwinder for SYSCALL_CANCEL.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 7/8] nptl: Do not install libpthread.so and do not link tests with it
  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
  0 siblings, 0 replies; 15+ messages in thread
From: Adhemerval Zanella @ 2021-05-24 17:14 UTC (permalink / raw)
  To: Florian Weimer, libc-alpha



On 21/05/2021 09:46, Florian Weimer via Libc-alpha wrote:
> Keep installing libpthread.a, so that -lpthread works.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  nptl/Makefile           | 30 +++++-------------------------
>  sysdeps/nptl/Makeconfig |  8 ++++++--
>  2 files changed, 11 insertions(+), 27 deletions(-)
> 
> diff --git a/nptl/Makefile b/nptl/Makefile
> index 64cd0dcbf6..52d1d193d9 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -204,12 +204,15 @@ routines = \
>    unwind \
>    vars \
>  
> -shared-only-routines = forward
>  static-only-routines = pthread_atfork
> -
>  libpthread-routines = libpthread-compat
>  libpthread-shared-only-routines = libpthread-compat
>  
> +# Pretend that libpthread.so is a linker script, so that the symbolic
> +# link is not installed.
> +install-lib-ldscripts = libpthread.so
> +$(inst_libdir)/libpthread.so:
> +
>  # Since cancellation handling is in large parts handled using exceptions
>  # we have to compile some files with exception handling enabled, some
>  # even with asynchronous unwind tables.

Ok.

> @@ -374,8 +377,6 @@ else
>  tests-printers-libs := $(static-thread-library)
>  endif
>  
> -LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete
> -
>  tests += tst-cancelx7 tst-cancelx17
>  
>  ifeq ($(build-shared),yes)

Ok.

> @@ -469,7 +470,6 @@ ifeq (yes,$(build-shared))
>  lib-noranlib: $(addprefix $(objpfx),$(extra-objs))
>  endif
>  
> -
>  # 'pthread_self' is a simple memory or register load.  Setting up the
>  # stack frame is more work than the actual operation.  Disable the
>  # frame creation entirely.  This will help applications which call the

Spurious line removal.

> @@ -548,35 +548,15 @@ else
>  librt = $(common-objpfx)rt/librt.a
>  endif
>  
> -# `make check' sometimes triggers a rebuild of librt.so using this Makefile,
> -# which ignores librt's dependence on libpthread
> -$(common-objpfx)rt/librt.so: $(shared-thread-library)
> -
>  $(objpfx)tst-cancel17: $(librt)
>  $(objpfx)tst-cancelx17: $(librt)
>  
>  LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++
>  LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
>  
> -# Make sure we link with the thread library.
>  ifeq ($(build-shared),yes)
> -$(addprefix $(objpfx), \
> -  $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
> -    $(tests-nolibpthread), \
> -    $(tests) $(tests-internal) $(xtests) $(test-srcs) $(tests-container))): \
> -	$(objpfx)libpthread.so
>  $(objpfx)tst-unload: $(libdl)
> -# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
> -# since otherwise libpthread.so comes before libc.so when linking.
> -$(addprefix $(objpfx), $(tests-reverse)): \
> -  $(objpfx)../libc.so $(objpfx)libpthread.so
> -$(objpfx)../libc.so: $(common-objpfx)libc.so ;
> -$(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(objpfx)libpthread.a
> -else
> -$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
> -endif
>  
> -ifeq ($(build-shared),yes)
>  generated += multidir.mk tst-tls6.out
>  endif
>  

Ok.

> diff --git a/sysdeps/nptl/Makeconfig b/sysdeps/nptl/Makeconfig
> index 8757ec868b..8a9407925c 100644
> --- a/sysdeps/nptl/Makeconfig
> +++ b/sysdeps/nptl/Makeconfig
> @@ -21,7 +21,11 @@
>  
>  have-thread-library = yes
>  
> -shared-thread-library = $(common-objpfx)nptl/libpthread.so
> -static-thread-library = $(common-objpfx)nptl/libpthread.a
> +# The thread library is integrated.
> +shared-thread-library =
> +static-thread-library =
>  
> +# Some tests need this to load their own test objects, and system
> +# libraries used by memusagestat need to link against the empty
> +# libpthread.so.0, not the (potentially non-empty) system version.
>  rpath-dirs += nptl
> 

Ok.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 8/8] Linux: Remove remaining references to $(shared-thread-library)
  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
  0 siblings, 0 replies; 15+ messages in thread
From: Adhemerval Zanella @ 2021-05-24 18:27 UTC (permalink / raw)
  To: Florian Weimer, libc-alpha



On 21/05/2021 09:46, Florian Weimer via Libc-alpha wrote:
> Since the variable expands to nothing under Linux, it is no longer
> necessary to clutter the makefiles with it.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  nptl/Makefile                         | 21 +++++++--------------
>  sysdeps/mips/Makefile                 |  2 --
>  sysdeps/unix/sysv/linux/Makefile      |  6 ------
>  sysdeps/unix/sysv/linux/i386/Makefile |  1 -
>  4 files changed, 7 insertions(+), 23 deletions(-)
> 
> diff --git a/nptl/Makefile b/nptl/Makefile
> index 52d1d193d9..060d6eebd6 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -371,12 +371,6 @@ CPPFLAGS-tst-pthread-gdb-attach-static.c := \
>  # were launched with an explicit ld.so invocation.
>  tst-pthread-gdb-attach-no-pie = yes
>  
> -ifeq ($(build-shared),yes)
> -tests-printers-libs := $(shared-thread-library)
> -else
> -tests-printers-libs := $(static-thread-library)
> -endif
> -
>  tests += tst-cancelx7 tst-cancelx17
>  
>  ifeq ($(build-shared),yes)

Ok.

> @@ -501,7 +495,7 @@ $(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out
>  	$(evaluate-test)
>  generated += tst-stack3-mem.out tst-stack3.mtrace
>  
> -$(objpfx)tst-stack4: $(libdl) $(shared-thread-library)
> +$(objpfx)tst-stack4: $(libdl)
>  tst-stack4mod.sos=$(shell for i in 0 1 2 3 4 5 6 7 8 9 10 \
>  				   11 12 13 14 15 16 17 18 19; do \
>  			    for j in 0 1 2 3 4 5 6 7 8 9 10 \

Ok.

> @@ -514,19 +508,18 @@ $(tst-stack4mod.sos): $(objpfx)tst-stack4mod.so
>  clean:
>  	rm -f $(tst-stack4mod.sos)
>  
> -$(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o $(shared-thread-library)
> -$(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o $(shared-thread-library)
> +$(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o
> +$(objpfx)tst-cleanupx4: $(objpfx)tst-cleanupx4aux.o
>  
> -$(objpfx)tst-tls3: $(libdl) $(shared-thread-library)
> +$(objpfx)tst-tls3: $(libdl)
>  LDFLAGS-tst-tls3 = -rdynamic
>  $(objpfx)tst-tls3.out: $(objpfx)tst-tls3mod.so
> -$(objpfx)tst-tls3mod.so: $(shared-thread-library)
>  
> -$(objpfx)tst-tls3-malloc: $(libdl) $(shared-thread-library)
> +$(objpfx)tst-tls3-malloc: $(libdl)
>  LDFLAGS-tst-tls3-malloc = -rdynamic
>  $(objpfx)tst-tls3-malloc.out: $(objpfx)tst-tls3mod.so
>  
> -$(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library)
> +$(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so
>  LDFLAGS-tst-tls5 = -Wl,--no-as-needed
>  LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
>  

Ok.

> @@ -540,7 +533,7 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \
>  	$(evaluate-test)
>  endif
>  
> -$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
> +$(objpfx)tst-dlsym1: $(libdl)
>  
>  ifeq (yes,$(build-shared))
>  librt = $(common-objpfx)rt/librt.so

Ok.

> diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile
> index 19e6a57622..150518bc6d 100644
> --- a/sysdeps/mips/Makefile
> +++ b/sysdeps/mips/Makefile
> @@ -72,8 +72,6 @@ endif
>  ifeq ($(mips-mode-switch),yes)
>  ifeq ($(o32-fpabi),xx)
>  tests += tst-mode-switch-1 tst-mode-switch-2 tst-mode-switch-3
> -$(objpfx)tst-mode-switch-1: $(shared-thread-library)
> -$(objpfx)tst-mode-switch-2: $(shared-thread-library)
>  endif
>  endif
>  endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index fb155cf856..e9566e028a 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -179,8 +179,6 @@ $(objpfx)tst-glibcsyscalls.out: \
>  # Separate object file for access to the constant from the UAPI header.
>  $(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o
>  
> -$(objpfx)tst-pkey: $(shared-thread-library)
> -
>  tests-special += $(objpfx)tst-mman-consts.out
>  $(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py
>  	$(sysdeps-linux-python) \

Ok.

> @@ -189,10 +187,6 @@ $(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py
>  	  < /dev/null > $@ 2>&1; $(evaluate-test)
>  $(objpfx)tst-mman-consts.out: $(sysdeps-linux-python-deps)
>  
> -$(objpfx)tst-gettid: $(shared-thread-library)
> -$(objpfx)tst-gettid-kill: $(shared-thread-library)
> -$(objpfx)tst-tgkill: $(shared-thread-library)
> -
>  endif # $(subdir) == misc
>  
>  ifeq ($(subdir),time)

Ok.

> diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
> index 26e0a8852b..abd0009d58 100644
> --- a/sysdeps/unix/sysv/linux/i386/Makefile
> +++ b/sysdeps/unix/sysv/linux/i386/Makefile
> @@ -5,7 +5,6 @@ ifeq ($(subdir),misc)
>  sysdep_routines += ioperm iopl vm86
>  
>  tests += tst-bz21269
> -$(objpfx)tst-bz21269: $(shared-thread-library)
>  endif
>  
>  ifeq ($(subdir),elf)
> 


Ok.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-05-24 18:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 3/8] nptl: Move semi-public __pthread_get_minstack symbol into libc Florian Weimer
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

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).