[PATCH 09/10] htl: move pthread_rwlock_init into libc.

gfleury gfleury@disroot.org
Sat Feb 15 12:50:12 GMT 2025


Signed-off-by: gfleury <gfleury@disroot.org>
---
 htl/Makefile                                |  2 +-
 htl/Versions                                |  4 +---
 sysdeps/htl/libc-lockP.h                    |  2 +-
 sysdeps/htl/pt-rwlock-init.c                | 10 ++++++++--
 sysdeps/mach/hurd/i386/libc.abilist         |  2 ++
 sysdeps/mach/hurd/i386/libpthread.abilist   |  1 -
 sysdeps/mach/hurd/x86_64/libc.abilist       |  1 +
 sysdeps/mach/hurd/x86_64/libpthread.abilist |  1 -
 8 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/htl/Makefile b/htl/Makefile
index b48ee842..5d5cac0b 100644
--- a/htl/Makefile
+++ b/htl/Makefile
@@ -45,7 +45,6 @@ libpthread-routines := \
   pt-testcancel \
   pt-cancel \
   pt-mutex-transfer-np \
-  pt-rwlock-init \
   pt-hurd-cond-wait \
   pt-hurd-cond-timedwait \
   pt-stack-alloc \
@@ -189,6 +188,7 @@ routines := \
   pt-nthreads \
   pt-rwlock-attr \
   pt-rwlock-destroy \
+  pt-rwlock-init \
   pt-rwlock-rdlock \
   pt-rwlock-timedrdlock \
   pt-rwlock-timedwrlock \
diff --git a/htl/Versions b/htl/Versions
index b4734bcc..dda44eb4 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -64,6 +64,7 @@ libc {
     pthread_mutexattr_setpshared;
     pthread_mutexattr_settype;
     pthread_rwlock_destroy;
+    pthread_rwlock_init;
     pthread_rwlock_rdlock;
     pthread_rwlock_timedrdlock;
     pthread_rwlock_timedwrlock;
@@ -258,8 +259,6 @@ libpthread {
 
     pthread_once;
 
-    pthread_rwlock_init;
-
     pthread_setconcurrency;
     pthread_setschedprio; pthread_setspecific;
 
@@ -313,6 +312,5 @@ libpthread {
     __pthread_getattr_np;
     __pthread_enable_asynccancel;
     __pthread_disable_asynccancel;
-    _pthread_rwlock_init;
   }
 }
diff --git a/sysdeps/htl/libc-lockP.h b/sysdeps/htl/libc-lockP.h
index 1b5c23eb..5085570b 100644
--- a/sysdeps/htl/libc-lockP.h
+++ b/sysdeps/htl/libc-lockP.h
@@ -92,6 +92,7 @@ libc_hidden_proto (__pthread_mutexattr_destroy)
 
 extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
 				  const pthread_rwlockattr_t *__attr);
+libc_hidden_proto (__pthread_rwlock_init)
 
 extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
 libc_hidden_proto (__pthread_rwlock_destroy)
@@ -124,7 +125,6 @@ libc_hidden_proto (__pthread_setcancelstate)
    single-threaded processes.  */
 #if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
 # ifdef weak_extern
-weak_extern (__pthread_rwlock_init)
 weak_extern (__pthread_key_create)
 weak_extern (__pthread_setspecific)
 weak_extern (__pthread_getspecific)
diff --git a/sysdeps/htl/pt-rwlock-init.c b/sysdeps/htl/pt-rwlock-init.c
index 02bd1bff..d177dbb4 100644
--- a/sysdeps/htl/pt-rwlock-init.c
+++ b/sysdeps/htl/pt-rwlock-init.c
@@ -19,9 +19,10 @@
 #include <pthread.h>
 #include <string.h>
 #include <pt-internal.h>
+#include <shlib-compat.h>
 
 int
-_pthread_rwlock_init (pthread_rwlock_t *rwlock,
+__pthread_rwlock_init (pthread_rwlock_t *rwlock,
 		      const pthread_rwlockattr_t *attr)
 {
   ASSERT_TYPE_SIZE (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T);
@@ -42,5 +43,10 @@ _pthread_rwlock_init (pthread_rwlock_t *rwlock,
   *rwlock->__attr = *attr;
   return 0;
 }
+libc_hidden_def (__pthread_rwlock_init)
+versioned_symbol (libc, __pthread_rwlock_init, pthread_rwlock_init, GLIBC_2_42);
 
-strong_alias (_pthread_rwlock_init, pthread_rwlock_init);
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42)
+compat_symbol (libpthread, __pthread_rwlock_init, pthread_rwlock_init, GLIBC_2_12);
+compat_symbol (libpthread, __pthread_rwlock_init, _pthread_rwlock_init, GLIBC_2_12);
+#endif
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 5966862c..e51794a5 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -89,6 +89,7 @@ GLIBC_2.12 pthread_mutexattr_setprotocol F
 GLIBC_2.12 pthread_mutexattr_setpshared F
 GLIBC_2.12 pthread_mutexattr_settype F
 GLIBC_2.12 pthread_rwlock_destroy F
+GLIBC_2.12 pthread_rwlock_init F
 GLIBC_2.12 pthread_rwlock_rdlock F
 GLIBC_2.12 pthread_rwlock_timedrdlock F
 GLIBC_2.12 pthread_rwlock_timedwrlock F
@@ -2595,6 +2596,7 @@ GLIBC_2.42 pthread_mutex_getprioceiling F
 GLIBC_2.42 pthread_mutex_setprioceiling F
 GLIBC_2.42 pthread_mutex_trylock F
 GLIBC_2.42 pthread_rwlock_destroy F
+GLIBC_2.42 pthread_rwlock_init F
 GLIBC_2.42 pthread_rwlock_tryrdlock F
 GLIBC_2.42 pthread_rwlock_trywrlock F
 GLIBC_2.42 pthread_rwlockattr_destroy F
diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
index 3ebfa637..d9c1a179 100644
--- a/sysdeps/mach/hurd/i386/libpthread.abilist
+++ b/sysdeps/mach/hurd/i386/libpthread.abilist
@@ -36,7 +36,6 @@ GLIBC_2.12 pthread_key_delete F
 GLIBC_2.12 pthread_kill F
 GLIBC_2.12 pthread_mutex_transfer_np F
 GLIBC_2.12 pthread_once F
-GLIBC_2.12 pthread_rwlock_init F
 GLIBC_2.12 pthread_setconcurrency F
 GLIBC_2.12 pthread_setschedprio F
 GLIBC_2.12 pthread_setspecific F
diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist
index ec6e20a9..a8f56222 100644
--- a/sysdeps/mach/hurd/x86_64/libc.abilist
+++ b/sysdeps/mach/hurd/x86_64/libc.abilist
@@ -2278,6 +2278,7 @@ GLIBC_2.42 pthread_mutex_getprioceiling F
 GLIBC_2.42 pthread_mutex_setprioceiling F
 GLIBC_2.42 pthread_mutex_trylock F
 GLIBC_2.42 pthread_rwlock_destroy F
+GLIBC_2.42 pthread_rwlock_init F
 GLIBC_2.42 pthread_rwlock_tryrdlock F
 GLIBC_2.42 pthread_rwlock_trywrlock F
 GLIBC_2.42 pthread_rwlockattr_destroy F
diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist
index 106aa09d..71ce1d62 100644
--- a/sysdeps/mach/hurd/x86_64/libpthread.abilist
+++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist
@@ -56,7 +56,6 @@ GLIBC_2.38 pthread_key_delete F
 GLIBC_2.38 pthread_kill F
 GLIBC_2.38 pthread_mutex_transfer_np F
 GLIBC_2.38 pthread_once F
-GLIBC_2.38 pthread_rwlock_init F
 GLIBC_2.38 pthread_setconcurrency F
 GLIBC_2.38 pthread_setschedprio F
 GLIBC_2.38 pthread_setspecific F
-- 
2.39.5



More information about the Libc-alpha mailing list