Commit 307ed7b8f0 for openssl.org
commit 307ed7b8f0345d21a4c900633b3ffc3b5ca064d7
Author: Randall S. Becker <randall.becker@nexbridge.ca>
Date: Mon Feb 2 17:31:13 2026 +0000
Guard RWLOCK methods by USE_RWLOCK in threads_pthread.c
Fixes: #29883
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Feb 4 15:55:47 2026
(Merged from https://github.com/openssl/openssl/pull/29924)
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c
index 75d26c9b30..ca2cde003e 100644
--- a/crypto/threads_pthread.c
+++ b/crypto/threads_pthread.c
@@ -95,7 +95,7 @@
* implementation
* Likewise is there a problem with the glibc implementation on riscv.
*/
-#if defined(PTHREAD_RWLOCK_INITIALIZER) && !defined(_KLT_MODEL_) \
+#if defined(PTHREAD_RWLOCK_INITIALIZER) && !defined(_KLT_MODEL_) && !defined(_PUT_MODEL_) \
&& !defined(__riscv)
#define USE_RWLOCK
#endif
@@ -852,6 +852,7 @@ static ossl_inline int ossl_rwlock_unlock(pthread_rwlock_t *lock)
#else /* !REPORT_RWLOCK_CONTENTION */
+#if defined(USE_RWLOCK)
static ossl_inline void ossl_init_rwlock_contention_data(void)
{
}
@@ -870,6 +871,7 @@ static ossl_inline int ossl_rwlock_unlock(pthread_rwlock_t *rwlock)
{
return pthread_rwlock_unlock(rwlock);
}
+#endif /* USE_RWLOCK */
#endif /* REPORT_RWLOCK_CONTENTION */
CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)