From c86f77d40e74cbbd6bc2bb4b2d8aaa30bac04f23 Mon Sep 17 00:00:00 2001
From: Gleb Mazovetskiy <glex.spb@gmail.com>
Date: Thu, 28 Nov 2024 16:00:06 +0000
Subject: [PATCH] define PTHREAD_RWLOCK_INITIALIZER

Per https://github.com/macports/macports-ports/pull/26655#issuecomment-2506351012

Remove this patch once
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117834 is resolved
---
 libgcc/gthr-posix.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git libgcc/gthr-posix.h libgcc/gthr-posix.h
index 82e8f9ffcf6..f87283cb0e4 100644
--- libgcc/gthr-posix.h
+++ libgcc/gthr-posix.h
@@ -62,6 +62,12 @@ typedef struct timespec __gthread_time_t;
 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
 #define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
 #ifndef __cplusplus
+#ifndef PTHREAD_RWLOCK_INITIALIZER
+#ifndef _PTHREAD_RWLOCK_SIG_init
+#define _PTHREAD_RWLOCK_SIG_init    0x2DA8B3B4
+#endif
+#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWLOCK_SIG_init, {0}}
+#endif
 #define __GTHREAD_RWLOCK_INIT PTHREAD_RWLOCK_INITIALIZER
 #endif
 #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
-- 
2.43.0

