Hi,

This patch adds missing implementation of TARGET_D_CRITSEC_SIZE, which
would be noticed when using any bare synchronized statements.

I couldn't see any target-specific alternatives of pthread_mutex_t in
netbsd headers, so the condition should be right.

OK for trunk?

-- 
Iain
---
gcc/ChangeLog:

2019-04-24  Iain Buclaw  <ibuc...@gdcproject.org>

        * config/netbsd-d.c (netbsd_d_critsec_size): New function.
        (TARGET_D_CRITSEC_SIZE): Define as netbsd_d_critsec_size.

---
diff --git a/gcc/config/netbsd-d.c b/gcc/config/netbsd-d.c
index 76342aacae3..c49366dc23b 100644
--- a/gcc/config/netbsd-d.c
+++ b/gcc/config/netbsd-d.c
@@ -28,6 +28,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "d/d-target.h"
 #include "d/d-target-def.h"
 
+/* Implement TARGET_D_OS_VERSIONS for NetBSD targets.  */
+
 static void
 netbsd_d_os_builtins (void)
 {
@@ -35,7 +37,19 @@ netbsd_d_os_builtins (void)
   d_add_builtin_version ("NetBSD");
 }
 
+/* Implement TARGET_D_CRITSEC_SIZE for NetBSD targets.  */
+
+static unsigned
+netbsd_d_critsec_size (void)
+{
+  /* This is the sizeof pthread_mutex_t.  */
+  return (POINTER_SIZE == 64) ? 48 : 28;
+}
+
 #undef TARGET_D_OS_VERSIONS
 #define TARGET_D_OS_VERSIONS netbsd_d_os_builtins
 
+#undef TARGET_D_CRITSEC_SIZE
+#define TARGET_D_CRITSEC_SIZE netbsd_d_critsec_size
+
 struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;

Reply via email to