]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
htl: move pthread_exit into libc.
authorgfleury <gfleury@disroot.org>
Fri, 15 Aug 2025 18:14:57 +0000 (20:14 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Fri, 15 Aug 2025 23:44:51 +0000 (01:44 +0200)
Message-ID: <20250815181500.107433-17-gfleury@disroot.org>

12 files changed:
htl/Makefile
htl/Versions
htl/forward.c
htl/pt-exit.c
htl/pt-initialize.c
htl/pt-setcancelstate.c
htl/pt-setcanceltype.c
sysdeps/htl/pthread-functions.h
sysdeps/htl/pthreadP.h
sysdeps/mach/hurd/i386/libc.abilist
sysdeps/mach/hurd/i386/libpthread.abilist
sysdeps/mach/hurd/x86_64/libpthread.abilist

index 4982409c77e71211c362a3cb51064c316d338219..8530098a71493425888063ec3e21edcf88d3325e 100644 (file)
@@ -26,7 +26,6 @@ LCLHDRS :=
 
 libpthread-routines := \
   pt-create \
-  pt-exit \
   pt-initialize \
   pt-join \
   pt-spin-inlines \
@@ -141,6 +140,7 @@ routines := \
   pt-destroy-specific \
   pt-detach \
   pt-docancel \
+  pt-exit \
   pt-getattr \
   pt-getconcurrency \
   pt-getcpuclockid \
index 322c09f908fe480dacc5b62f78cd18281a954706..44af006b74cdb5b4d0ec253f5c06d3722573794c 100644 (file)
@@ -58,6 +58,7 @@ libc {
     pthread_key_create;
     pthread_key_delete;
     pthread_kill;
+    pthread_exit;
     pthread_mutex_destroy;
     pthread_mutex_getprioceiling;
     pthread_mutex_init;
@@ -245,6 +246,7 @@ libc {
     __pthread_condattr_init;
     __pthread_default_condattr;
     __pthread_destroy_specific;
+    __pthread_exit;
     __pthread_getspecific;
     __pthread_key_delete;
     __pthread_max_threads;
@@ -297,7 +299,7 @@ libpthread {
 
     pthread_atfork;
 
-    pthread_create; pthread_exit;
+    pthread_create;
 
     pthread_join;
 
index 21acf664f449c1a6fcefc46bdefc34387ba8796c..9294d2572410b46d3476e259ea0f251109ea8fd6 100644 (file)
 /* Pointers to the libc functions.  */
 struct pthread_functions __libc_pthread_functions attribute_hidden;
 int __libc_pthread_functions_init attribute_hidden;
-
-
-#define FORWARD2(name, rettype, decl, params, defaction) \
-rettype                                                                              \
-name decl                                                                    \
-{                                                                            \
-  if (!__libc_pthread_functions_init)                                        \
-    defaction;                                                               \
-                                                                             \
-  return PTHFCT_CALL (ptr_##name, params);                                   \
-}
-
-/* Same as FORWARD2, only without return.  */
-#define FORWARD_NORETURN(name, rettype, decl, params, defaction) \
-rettype                                                                              \
-name decl                                                                    \
-{                                                                            \
-  if (!__libc_pthread_functions_init)                                        \
-    defaction;                                                               \
-                                                                             \
-  PTHFCT_CALL (ptr_##name, params);                                          \
-}
-
-#define FORWARD(name, decl, params, defretval) \
-  FORWARD2 (name, int, decl, params, return defretval)
-
-/* Use an alias to avoid warning, as pthread_exit is declared noreturn.  */
-FORWARD_NORETURN (__pthread_exit, void, (void *retval), (retval),
-                 exit (EXIT_SUCCESS))
-strong_alias (__pthread_exit, pthread_exit);
index 2aba0433818e4e4c8ac1a1407f9ebc46922c29d7..9d331d0d81d21b9390d317d097a7681d68f5d5cd 100644 (file)
@@ -25,7 +25,7 @@
 #include <pthreadP.h>
 
 #include <atomic.h>
-
+#include <shlib-compat.h>
 
 /* Terminate the current thread and make STATUS available to any
    thread that might join it.  */
@@ -112,4 +112,9 @@ __pthread_exit (void *status)
   abort ();
 }
 
-weak_alias (__pthread_exit, pthread_exit);
+libc_hidden_def (__pthread_exit)
+versioned_symbol (libc, __pthread_exit, pthread_exit, GLIBC_2_21);
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21)
+compat_symbol (libpthread, __pthread_exit, pthread_exit, GLIBC_2_12);
+#endif
index b4e8b15b475a331e9d1f9f3e95fb609a472a74f0..a4e49edfa621f8e3a4a652648622fe55e7bd1a3b 100644 (file)
@@ -27,7 +27,6 @@
 
 #if IS_IN (libpthread)
 static const struct pthread_functions pthread_functions = {
-  .ptr___pthread_exit = __pthread_exit,
   .ptr__IO_flockfile = _cthreads_flockfile,
   .ptr__IO_funlockfile = _cthreads_funlockfile,
   .ptr__IO_ftrylockfile = _cthreads_ftrylockfile,
index 0d5692e66187d77769c0841c32b08e4dba02c4ea..d1f14de8548a023c2c826894e85a1908e8336eb0 100644 (file)
@@ -45,7 +45,7 @@ __pthread_setcancelstate (int state, int *oldstate)
     p->cancel_pending = 2;
   __pthread_mutex_unlock (&p->cancel_lock);
 
-  if (cancelled && __pthread_exit)
+  if (cancelled)
     __pthread_exit (PTHREAD_CANCELED);
 
   return 0;
index b33931c4688a1f425ed0300e680d32be701acc07..73aac5fd3cc538fbfefd070545fd1e885268eafa 100644 (file)
@@ -42,7 +42,7 @@ __pthread_setcanceltype (int type, int *oldtype)
   cancelled = (p->cancel_state == PTHREAD_CANCEL_ENABLE) && p->cancel_pending && (p->cancel_type == PTHREAD_CANCEL_ASYNCHRONOUS);
   __pthread_mutex_unlock (&p->cancel_lock);
 
-  if (cancelled && __pthread_exit)
+  if (cancelled)
     __pthread_exit (PTHREAD_CANCELED);
 
   return 0;
index aec13a6022f08a4f7a502fc00a292b12135acd5d..1fde0aeaa338ca80d6dd20182bd912dab4ac25ec 100644 (file)
@@ -21,8 +21,6 @@
 
 #include <pthread.h>
 
-void __pthread_exit (void *) __attribute__ ((__noreturn__));
-
 void _cthreads_flockfile (FILE *);
 void _cthreads_funlockfile (FILE *);
 int _cthreads_ftrylockfile (FILE *);
@@ -32,7 +30,6 @@ int _cthreads_ftrylockfile (FILE *);
    so if possible avoid breaking it and append new hooks to the end.  */
 struct pthread_functions
 {
-  void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__));
   void (*ptr__IO_flockfile) (FILE *);
   void (*ptr__IO_funlockfile) (FILE *);
   int (*ptr__IO_ftrylockfile) (FILE *);
index 98850e9f1dc020cdb30c1768b12d5cec38dec271..e0f0f7d45de3ab3439aa26c76b018e6e8466dc94 100644 (file)
@@ -182,6 +182,7 @@ void __cthread_detach (__cthread_t);
 int __pthread_detach (pthread_t __threadp);
 libc_hidden_proto (__pthread_detach)
 void __pthread_exit (void *value) __attribute__ ((__noreturn__));
+libc_hidden_proto (__pthread_exit)
 int __pthread_join (pthread_t, void **);
 int __cthread_keycreate (__cthread_key_t *);
 int __cthread_getspecific (__cthread_key_t, void **);
@@ -233,14 +234,6 @@ libc_hidden_proto (__pthread_get_cleanup_stack)
 hidden_proto (__pthread_create)
 #endif
 
-#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
-# ifdef weak_extern
-weak_extern (__pthread_exit)
-# else
-#  pragma weak __pthread_exit
-# endif
-#endif
-
 #define ASSERT_TYPE_SIZE(type, size)                                   \
   _Static_assert (sizeof (type) == size,                               \
                  "sizeof (" #type ") != " #size)
index da2ad4ae668524a63f031b8a78d82b209b2a58f9..2ec557b26d95d1edd7f3d8e238b0a694bd170a0c 100644 (file)
@@ -75,6 +75,7 @@ GLIBC_2.12 pthread_condattr_setclock F
 GLIBC_2.12 pthread_condattr_setpshared F
 GLIBC_2.12 pthread_detach F
 GLIBC_2.12 pthread_equal F
+GLIBC_2.12 pthread_exit F
 GLIBC_2.12 pthread_getattr_np F
 GLIBC_2.12 pthread_getconcurrency F
 GLIBC_2.12 pthread_getcpuclockid F
index 094f7de25f2be392cbc86688b50d9871eb90cba1..3f3c17c15e13738781b74007ea31875107f9148d 100644 (file)
@@ -19,7 +19,6 @@ GLIBC_2.12 ftrylockfile F
 GLIBC_2.12 funlockfile F
 GLIBC_2.12 pthread_atfork F
 GLIBC_2.12 pthread_create F
-GLIBC_2.12 pthread_exit F
 GLIBC_2.12 pthread_join F
 GLIBC_2.12 pthread_spin_destroy F
 GLIBC_2.12 pthread_spin_init F
index 926d31b9cf88b7b1eb3f1fcd9b393f8eb02a2fe5..6dfca3f44d864fd4b924b7614fea0d4fe6df2cbb 100644 (file)
@@ -37,7 +37,6 @@ GLIBC_2.38 mtx_trylock F
 GLIBC_2.38 mtx_unlock F
 GLIBC_2.38 pthread_clockjoin_np F
 GLIBC_2.38 pthread_create F
-GLIBC_2.38 pthread_exit F
 GLIBC_2.38 pthread_hurd_cond_timedwait_np F
 GLIBC_2.38 pthread_hurd_cond_wait_np F
 GLIBC_2.38 pthread_join F