summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:51 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-04-21 19:49:51 +0200
commiteb29dcde31e7b6f07e7acda161e85d2be69652e4 (patch)
tree763b41f1d40d74c8ae84d3c2622ef5709644b820 /nptl
parent9ce44f46754cc529d54418615862e7e27cc82f09 (diff)
downloadglibc-eb29dcde31e7b6f07e7acda161e85d2be69652e4.tar.gz
glibc-eb29dcde31e7b6f07e7acda161e85d2be69652e4.tar.xz
glibc-eb29dcde31e7b6f07e7acda161e85d2be69652e4.zip
nptl: Move rwlock functions with forwarders into libc
The forwarders were only used internally, so new symbol versions
are needed.  All symbols are moved at once because the forwarders
are no-ops if libpthread is not loaded, leading to inconsistencies
in case of a partial migration.

The symbols __pthread_rwlock_rdlock, __pthread_rwlock_unlock,
__pthread_rwlock_wrlock, pthread_rwlock_rdlock,
pthread_rwlock_unlock, pthread_rwlock_wrlock have been moved using
scripts/move-symbol-to-libc.py.

The __ symbol variants are turned into compat symbols, which is why they
do not receive a GLIBC_2.34 version.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/Makefile6
-rw-r--r--nptl/Versions17
-rw-r--r--nptl/nptl-init.c3
-rw-r--r--nptl/pthreadP.h4
-rw-r--r--nptl/pthread_rwlock_rdlock.c16
-rw-r--r--nptl/pthread_rwlock_unlock.c18
-rw-r--r--nptl/pthread_rwlock_wrlock.c16
7 files changed, 56 insertions, 24 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index df3423f5bf..db1b2aad08 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -85,6 +85,9 @@ routines = \
   pthread_kill \
   pthread_mutex_consistent \
   pthread_once \
+  pthread_rwlock_rdlock \
+  pthread_rwlock_unlock \
+  pthread_rwlock_wrlock \
   pthread_self \
   pthread_setcancelstate \
   pthread_setcanceltype \
@@ -174,13 +177,10 @@ libpthread-routines = \
   pthread_rwlock_clockwrlock \
   pthread_rwlock_destroy \
   pthread_rwlock_init \
-  pthread_rwlock_rdlock \
   pthread_rwlock_timedrdlock \
   pthread_rwlock_timedwrlock \
   pthread_rwlock_tryrdlock \
   pthread_rwlock_trywrlock \
-  pthread_rwlock_unlock \
-  pthread_rwlock_wrlock \
   pthread_rwlockattr_destroy \
   pthread_rwlockattr_getkind_np \
   pthread_rwlockattr_getpshared \
diff --git a/nptl/Versions b/nptl/Versions
index d32b554c05..b14f76aa41 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -49,6 +49,14 @@ libc {
   }
   GLIBC_2.1 {
     pthread_attr_init;
+    pthread_rwlock_rdlock;
+    pthread_rwlock_unlock;
+    pthread_rwlock_wrlock;
+  }
+  GLIBC_2.2 {
+    __pthread_rwlock_rdlock;
+    __pthread_rwlock_unlock;
+    __pthread_rwlock_wrlock;
   }
   GLIBC_2.2.3 {
     pthread_getattr_np;
@@ -104,6 +112,9 @@ libc {
     pthread_kill;
     pthread_mutex_consistent;
     pthread_once;
+    pthread_rwlock_rdlock;
+    pthread_rwlock_unlock;
+    pthread_rwlock_wrlock;
     pthread_setspecific;
   }
   GLIBC_PRIVATE {
@@ -205,11 +216,8 @@ libpthread {
     pthread_mutexattr_settype;
     pthread_rwlock_destroy;
     pthread_rwlock_init;
-    pthread_rwlock_rdlock;
     pthread_rwlock_tryrdlock;
     pthread_rwlock_trywrlock;
-    pthread_rwlock_unlock;
-    pthread_rwlock_wrlock;
     pthread_rwlockattr_destroy;
     pthread_rwlockattr_getkind_np;
     pthread_rwlockattr_getpshared;
@@ -238,11 +246,8 @@ libpthread {
   GLIBC_2.2 {
     __pthread_rwlock_destroy;
     __pthread_rwlock_init;
-    __pthread_rwlock_rdlock;
     __pthread_rwlock_tryrdlock;
     __pthread_rwlock_trywrlock;
-    __pthread_rwlock_unlock;
-    __pthread_rwlock_wrlock;
     __res_state;
     pthread_attr_getstack;
     pthread_attr_setstack;
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 1e57ff20d0..fae0db383c 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -66,9 +66,6 @@ static const struct pthread_functions pthread_functions =
     .ptr_pthread_mutex_init = __pthread_mutex_init,
     .ptr_pthread_mutex_lock = __pthread_mutex_lock,
     .ptr_pthread_mutex_unlock = __pthread_mutex_unlock,
-    .ptr___pthread_rwlock_rdlock = __pthread_rwlock_rdlock,
-    .ptr___pthread_rwlock_wrlock = __pthread_rwlock_wrlock,
-    .ptr___pthread_rwlock_unlock = __pthread_rwlock_unlock,
     .ptr__nptl_setxid = __nptl_setxid,
   };
 # define ptr_pthread_functions &pthread_functions
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index f09757bb26..2c59a1dc84 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -447,8 +447,10 @@ extern int __pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
 				  __attr);
 extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
 extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_rdlock)
 extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
 extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_wrlock)
 extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
 extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
 extern int __pthread_cond_broadcast (pthread_cond_t *cond);
@@ -559,8 +561,6 @@ hidden_proto (__pthread_mutex_destroy)
 hidden_proto (__pthread_mutex_lock)
 hidden_proto (__pthread_mutex_trylock)
 hidden_proto (__pthread_mutex_unlock)
-hidden_proto (__pthread_rwlock_rdlock)
-hidden_proto (__pthread_rwlock_wrlock)
 hidden_proto (__pthread_rwlock_unlock)
 hidden_proto (__pthread_testcancel)
 hidden_proto (__pthread_mutexattr_init)
diff --git a/nptl/pthread_rwlock_rdlock.c b/nptl/pthread_rwlock_rdlock.c
index 0eeee50834..366883ea3d 100644
--- a/nptl/pthread_rwlock_rdlock.c
+++ b/nptl/pthread_rwlock_rdlock.c
@@ -20,7 +20,7 @@
 
 /* See pthread_rwlock_common.c.  */
 int
-__pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
+___pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
 {
   LIBC_PROBE (rdlock_entry, 1, rwlock);
 
@@ -28,6 +28,16 @@ __pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
   LIBC_PROBE (rdlock_acquire_read, 1, rwlock);
   return result;
 }
+versioned_symbol (libc, ___pthread_rwlock_rdlock, pthread_rwlock_rdlock,
+		  GLIBC_2_34);
+strong_alias (___pthread_rwlock_rdlock, __pthread_rwlock_rdlock)
+libc_hidden_ver (___pthread_rwlock_rdlock, __pthread_rwlock_rdlock)
 
-weak_alias (__pthread_rwlock_rdlock, pthread_rwlock_rdlock)
-hidden_def (__pthread_rwlock_rdlock)
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_1, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_rwlock_rdlock, pthread_rwlock_rdlock,
+	       GLIBC_2_1);
+#endif
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_rwlock_rdlock, __pthread_rwlock_rdlock,
+	       GLIBC_2_2);
+#endif
diff --git a/nptl/pthread_rwlock_unlock.c b/nptl/pthread_rwlock_unlock.c
index 356d63a045..6c0da9786d 100644
--- a/nptl/pthread_rwlock_unlock.c
+++ b/nptl/pthread_rwlock_unlock.c
@@ -27,7 +27,7 @@
 
 /* See pthread_rwlock_common.c for an overview.  */
 int
-__pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
+___pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
 {
   LIBC_PROBE (rwlock_unlock, 1, rwlock);
 
@@ -43,6 +43,16 @@ __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
     __pthread_rwlock_rdunlock (rwlock);
   return 0;
 }
-
-weak_alias (__pthread_rwlock_unlock, pthread_rwlock_unlock)
-hidden_def (__pthread_rwlock_unlock)
+versioned_symbol (libc, ___pthread_rwlock_unlock, pthread_rwlock_unlock,
+		  GLIBC_2_34);
+strong_alias (___pthread_rwlock_unlock, __pthread_rwlock_unlock)
+libc_hidden_ver (___pthread_rwlock_unlock, __pthread_rwlock_unlock)
+
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_1, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_rwlock_unlock, pthread_rwlock_unlock,
+	       GLIBC_2_1);
+#endif
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_rwlock_unlock, __pthread_rwlock_unlock,
+	       GLIBC_2_2);
+#endif
diff --git a/nptl/pthread_rwlock_wrlock.c b/nptl/pthread_rwlock_wrlock.c
index 98882a87e4..be20618d52 100644
--- a/nptl/pthread_rwlock_wrlock.c
+++ b/nptl/pthread_rwlock_wrlock.c
@@ -20,7 +20,7 @@
 
 /* See pthread_rwlock_common.c.  */
 int
-__pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
+___pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
 {
   LIBC_PROBE (wrlock_entry, 1, rwlock);
 
@@ -28,6 +28,16 @@ __pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
   LIBC_PROBE (wrlock_acquire_write, 1, rwlock);
   return result;
 }
+versioned_symbol (libc, ___pthread_rwlock_wrlock, pthread_rwlock_wrlock,
+		  GLIBC_2_34);
+strong_alias (___pthread_rwlock_wrlock, __pthread_rwlock_wrlock)
+libc_hidden_ver (___pthread_rwlock_wrlock, __pthread_rwlock_wrlock)
 
-weak_alias (__pthread_rwlock_wrlock, pthread_rwlock_wrlock)
-hidden_def (__pthread_rwlock_wrlock)
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_1, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_rwlock_wrlock, pthread_rwlock_wrlock,
+	       GLIBC_2_1);
+#endif
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_34)
+compat_symbol (libpthread, ___pthread_rwlock_wrlock, __pthread_rwlock_wrlock,
+	       GLIBC_2_2);
+#endif