diff mbox

[v2] Clean pthread types namespace for all archs.

Message ID CAD82F-oZp-5ZHGxHihehxdFu1_o_=o2gPHWzOmiKHxFps1DWHQ@mail.gmail.com
State New
Headers show

Commit Message

Juan Manuel Torres Palma June 24, 2015, 8 p.m. UTC
This patch sorts out pthread_mutex_t and pthread_cond_t in
new files, so new C11 types could be based on pthread types
without corrupting namespaces and exposing pthread symbols.

Common pthread types like pthread_mutex_t and pthread_cond_t are now
defined in bits/pthreadtypes-common.h, while the internal implementation
is moved to bits/thread-shared-types.h. File pthreadtypes.h has just
been cleaned up of those definitions and some related macros and
structures.

This is a second version of a patch that I submitted yesterday. Joseph
Myers found a few issue that I think I have solved for this version.
It consists in moving some code around some files, so it should work
in all architectures. However, I might have messed something and I
have only had the chance to test it in x86_64.

ChangeLog is attached to the email too, I haven't configured my email
client yet, sorry.

Cheers.

2015-06-24  Juan Manuel Torres Palma  <jmtorrespalma@gmail.com>

    * posix/Makefile (headers): Add files bits/pthreadtypes-common.h
    and bits/thread-shared-types.h to this variable.
    * bits/pthreadtypes-common.h: New file.
    (pthread_mutex_t): Move struct definition.
    (pthread_cond_t): Likewise.
    * bits/thread-shared-types.h: New file.
    * sysdeps/x86/bits/thread-shared-types.h: New file.
    (__SIZEOF_PTHREAD_MUTEX_T): Definition.
    (__SIZEOF_PTHREAD_COND_T): Likewise.
    (__pthread_list_t) [__x86_64__]: Likewise.
    (__pthread_slist_t) [!__x86_64__]: Likewise.
    (__pthread_mutex_s): Likewise.
    (__PTHREAD_MUTEX_T_CONTENT): Likewise.
    (__PTHREAD_COND_T_CONTENT): Likewise.
    (__PTHREAD_MUTEX_HAVE_PREV)[__x86_64__]: Likewise
    (__elision)[!__x86_64__]: Likewise
    (__spins)[!__x86_64__]: Likewise
    (__PTHREAD_SPINS): Likewise
    * sysdeps/aarch64/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/arm/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/hppa/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/ia64/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/m68k/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/microblaze/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/mips/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/nios2/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/s390/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/sh/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/sparc/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/tile/nptl/bits/thread-shared-types.h: Likewise.
    * sysdeps/unix/sysv/linux/alpha/bits/thread-shared-types.h: Likewise.
    * sysdeps/unix/sysv/linux/powerpc/bits/thread-shared-types.h: Likewise.
    * sysdeps/x86/bits/pthreadtypes.h: Include
    <bits/pthreadtypes-common.h>.
    (__SIZEOF_PTHREAD_MUTEX_T): Remove.
    (__SIZEOF_PTHREAD_COND_T): Likewise.
    (__pthread_list_t): Likewise.
    (__pthread_slist_t): Likewise.
    (__pthread_mutex_s): Likewise.
    (__PTHREAD_MUTEX_T_CONTENT): Likewise.
    (__PTHREAD_COND_T_CONTENT): Likewise.
    (__PTHREAD_MUTEX_HAVE_PREV): Likewise
    (__elision): Likewise
    (__spins): Likewise
    (__PTHREAD_SPINS): Likewise
    * sysdeps/aarch64/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/arm/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/hppa/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/ia64/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/m68k/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/microblaze/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/mips/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/nios2/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/s390/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/sh/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/sparc/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/tile/nptl/bits/pthreadtypes.h: Likewise.
    * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Likewise.
    * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.

Comments

Joseph Myers June 24, 2015, 8:07 p.m. UTC | #1
The general structure of this patch seems right to me, though since the 
justification of the patch is as part of the C11 threads implementation, 
the detailed review may make most sense when you have a full patch series 
implementing C11 threads ready to submit.  (Until then, it still makes 
sense to post successive patches for comments as you complete them, and to 
maintain a git branch somewhere with the current patch series, rebased as 
needed.  But it's less clear if the individual patches should go into 
master until more of the patch series is ready.)
diff mbox

Patch

commit b9e2fa0067ac2b8f4d31c0854bb75e4fcea3985b
Author: Juan Manuel Torres Palma <jmtorrespalma@gmail.com>
Date:   Wed Jun 24 21:14:58 2015 +0200

    Clean pthread types namespace for all archs.
    
    This patch sorts out pthread_mutex_t and pthread_cond_t in
    new files, so new C11 types could be based on pthread types
    without corrupting namespaces and exposing pthread symbols.
    
    Common pthread types like pthread_mutex_t and pthread_cond_t are now
    defined in bits/pthreadtypes-common.h, while the internal implementation
    is moved to bits/thread-shared-types.h. File pthreadtypes.h has just
    been cleaned up of those definitions and some related macros and
    structures.

diff --git a/bits/pthreadtypes-common.h b/bits/pthreadtypes-common.h
new file mode 100644
index 0000000..7276f84
--- /dev/null
+++ b/bits/pthreadtypes-common.h
@@ -0,0 +1,43 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+
+/* Declaration of common pthread types for all architectures.
+   Macros *_CONTENT are architecture dependent and defined in
+   bits/thread-shared-types.h */
+
+#ifndef _BITS_PTHREADTYPES_COMMON_H
+# define _BITS_PTHREADTYPES_COMMON_H	1
+
+# include <bits/thread-shared-types.h>
+
+/* Common definition of pthread_mutex_t. */
+
+typedef union
+{
+  __PTHREAD_MUTEX_T_CONTENT
+} pthread_mutex_t;
+
+
+/* Common definition of pthread_cond_t. */
+
+typedef union
+{
+  __PTHREAD_COND_T_CONTENT
+} pthread_cond_t;
+
+#endif /* bits/pthreadtypes-common.h */
diff --git a/bits/thread-shared-types.h b/bits/thread-shared-types.h
new file mode 100644
index 0000000..0e26952
--- /dev/null
+++ b/bits/thread-shared-types.h
@@ -0,0 +1 @@ 
+/* No thread support.  */
diff --git a/posix/Makefile b/posix/Makefile
index 15e8818..6de6f15 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -29,7 +29,8 @@  headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	      \
 	   bits/local_lim.h tar.h bits/utsname.h bits/confname.h	      \
 	   bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h	      \
 	   bits/sched.h re_comp.h wait.h bits/environments.h cpio.h	      \
-	   sys/sysmacros.h spawn.h bits/unistd.h
+	   sys/sysmacros.h spawn.h bits/unistd.h	                      \
+	   bits/thread-shared-types.h bits/pthreadtypes-common.h 
 
 routines :=								      \
 	uname								      \
diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
index 0e4795e..4905274 100644
--- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h
+++ b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
@@ -20,11 +20,10 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <endian.h>
+#include <pthreadtypes-common.h>
 
 #define __SIZEOF_PTHREAD_ATTR_T        64
-#define __SIZEOF_PTHREAD_MUTEX_T       48
 #define __SIZEOF_PTHREAD_MUTEXATTR_T    8
-#define __SIZEOF_PTHREAD_COND_T        48
 #define __SIZEOF_PTHREAD_COND_COMPAT_T 48
 #define __SIZEOF_PTHREAD_CONDATTR_T     8
 #define __SIZEOF_PTHREAD_RWLOCK_T      56
@@ -48,32 +47,11 @@  typedef union pthread_attr_t pthread_attr_t;
 # define __have_pthread_attr_t1
 #endif
 
-typedef struct __pthread_internal_list
-{
-  struct __pthread_internal_list *__prev;
-  struct __pthread_internal_list *__next;
-} __pthread_list_t;
-
 
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-    unsigned int __nusers;
-    int __kind;
-    int __spins;
-    __pthread_list_t __list;
-#define __PTHREAD_MUTEX_HAVE_PREV	1
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
+#define __PTHREAD_MUTEX_HAVE_PREV	1
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
 
@@ -86,22 +64,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/aarch64/nptl/bits/thread-shared-types.h b/sysdeps/aarch64/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..20990f7
--- /dev/null
+++ b/sysdeps/aarch64/nptl/bits/thread-shared-types.h
@@ -0,0 +1,75 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_PTHREAD_SHARED_TYPES_H
+#define _BITS_PTHREAD_SHARED_TYPES_H	1
+
+#define __SIZEOF_PTHREAD_MUTEX_T       48
+#define __SIZEOF_PTHREAD_COND_T        48
+
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  unsigned int __nusers;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+  short __spins;
+  __pthread_list_t __list;
+};
+
+
+#define __PTHREAD_MUTEX_T_CONTENT            \
+  struct __pthread_mutex_s __data;           \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];      \
+  long int __align;
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/pthread-shared-types.h */
diff --git a/sysdeps/arm/nptl/bits/pthreadtypes.h b/sysdeps/arm/nptl/bits/pthreadtypes.h
index 9f2efc2..1650ef1 100644
--- a/sysdeps/arm/nptl/bits/pthreadtypes.h
+++ b/sysdeps/arm/nptl/bits/pthreadtypes.h
@@ -19,11 +19,10 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <endian.h>
+#include <bits/pthreadtypes-common.h>
 
 #define __SIZEOF_PTHREAD_ATTR_T 36
-#define __SIZEOF_PTHREAD_MUTEX_T 24
 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
 #define __SIZEOF_PTHREAD_COND_COMPAT_T 12
 #define __SIZEOF_PTHREAD_CONDATTR_T 4
 #define __SIZEOF_PTHREAD_RWLOCK_T 32
@@ -48,34 +47,8 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
@@ -89,22 +62,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/arm/nptl/bits/thread-shared-types.h b/sysdeps/arm/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..993576e
--- /dev/null
+++ b/sysdeps/arm/nptl/bits/thread-shared-types.h
@@ -0,0 +1,78 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_COND_T 48
+
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+
+
+#define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;        \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
+  long int __align;
+
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h
index 845629d..4c4b0ed 100644
--- a/sysdeps/hppa/nptl/bits/pthreadtypes.h
+++ b/sysdeps/hppa/nptl/bits/pthreadtypes.h
@@ -18,6 +18,8 @@ 
 #ifndef _BITS_PTHREADTYPES_H
 #define _BITS_PTHREADTYPES_H	1
 
+#include <bits/pthreadtypes-common.h>
+
 /* Linuxthread type sizes (bytes):
    sizeof(pthread_attr_t) = 0x24 (36)
    sizeof(pthread_barrier_t) = 0x30 (48)
@@ -33,9 +35,7 @@ 
 #define __SIZEOF_PTHREAD_ATTR_T 36
 #define __SIZEOF_PTHREAD_BARRIER_T 48
 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
 #define __SIZEOF_PTHREAD_CONDATTR_T 4
-#define __SIZEOF_PTHREAD_MUTEX_T 48
 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
 #define __SIZEOF_PTHREAD_RWLOCK_T 64
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -55,44 +55,9 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
 typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock __attribute__ ((aligned(16)));
-    unsigned int __count;
-    int __owner;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-    /* The old 4-word 16-byte aligned lock. This is initalized
-       to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
-       Unused in NPTL.  */
-    int __compat_padding[4];
-    /* In the old structure there are 4 words left due to alignment.
-       In NPTL two words are used.  */
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-    /* Two more words are left before the NPTL
-       pthread_mutex_t is larger than Linuxthreads.  */
-    int __reserved1;
-    int __reserved2;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
@@ -111,35 +76,6 @@  typedef union
    version we must check, in every function using pthread_cond_t,
    for the static Linuxthreads initializer and clear the appropriate
    words. */
-typedef union
-{
-  struct
-  {
-    /* In the old Linuxthreads pthread_cond_t, this is the
-       start of the 4-word lock structure, the next four words
-       are set all to 1 by the Linuxthreads
-       PTHREAD_COND_INITIALIZER.  */
-    int __lock __attribute__ ((aligned(16)));
-    /* Tracks the initialization of this structure:
-       0  initialized with NPTL PTHREAD_COND_INITIALIZER.
-       1  initialized with Linuxthreads PTHREAD_COND_INITIALIZER.
-       2  initialization in progress.  */
-    int __initializer;
-    unsigned int __futex;
-    void *__mutex;
-    /* In the old Linuxthreads this would have been the start
-       of the pthread_fastlock status word.  */
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-    /* The NPTL pthread_cond_t is exactly the same size as
-       the Linuxthreads version, there are no words to spare.  */
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/hppa/nptl/bits/thread-shared-types.h b/sysdeps/hppa/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..31e61e4
--- /dev/null
+++ b/sysdeps/hppa/nptl/bits/thread-shared-types.h
@@ -0,0 +1,98 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#define __SIZEOF_PTHREAD_MUTEX_T 48
+#define __SIZEOF_PTHREAD_COND_T 48
+
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock __attribute__ ((aligned(16)));
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+  /* The old 4-word 16-byte aligned lock. This is initalized
+     to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
+     Unused in NPTL.  */
+  int __compat_padding[4];
+  /* In the old structure there are 4 words left due to alignment.
+     In NPTL two words are used.  */
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+  /* Two more words are left before the NPTL
+     pthread_mutex_t is larger than Linuxthreads.  */
+  int __reserved1;
+  int __reserved2;
+};
+
+#define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;        \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
+  long int __align;
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT          \
+  struct                                  \
+  {                                       \
+    /* In the old Linuxthreads pthread_cond_t, this is the
+       start of the 4-word lock structure, the next four words
+       are set all to 1 by the Linuxthreads
+       PTHREAD_COND_INITIALIZER.  */      \
+    int __lock __attribute__ ((aligned(16)));  \
+    /* Tracks the initialization of this structure:
+       0  initialized with NPTL PTHREAD_COND_INITIALIZER.
+       1  initialized with Linuxthreads PTHREAD_COND_INITIALIZER.
+       2  initialization in progress.  */ \
+    int __initializer;                    \
+    unsigned int __futex;                 \
+    void *__mutex;                        \
+    /* In the old Linuxthreads this would have been the start
+       of the pthread_fastlock status word.  */ \
+    __extension__ unsigned long long int __total_seq; \
+    __extension__ unsigned long long int __wakeup_seq; \
+    __extension__ unsigned long long int __woken_seq; \
+    unsigned int __nwaiters;              \
+    unsigned int __broadcast_seq;         \
+    /* The NPTL pthread_cond_t is exactly the same size as
+       the Linuxthreads version, there are no words to spare.  */ \
+  } __data;                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];   \
+  __extension__ long long int __align;
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/ia64/nptl/bits/pthreadtypes.h
index e9762f5..74f5c60 100644
--- a/sysdeps/ia64/nptl/bits/pthreadtypes.h
+++ b/sysdeps/ia64/nptl/bits/pthreadtypes.h
@@ -19,10 +19,10 @@ 
 #ifndef _BITS_PTHREADTYPES_H
 #define _BITS_PTHREADTYPES_H	1
 
+#include <bits/pthreadtypes-common.h>
+
 #define __SIZEOF_PTHREAD_ATTR_T 56
-#define __SIZEOF_PTHREAD_MUTEX_T 40
 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
 #define __SIZEOF_PTHREAD_CONDATTR_T 4
 #define __SIZEOF_PTHREAD_RWLOCK_T 56
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -46,33 +46,9 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-typedef struct __pthread_internal_list
-{
-  struct __pthread_internal_list *__prev;
-  struct __pthread_internal_list *__next;
-} __pthread_list_t;
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
 typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-    unsigned int __nusers;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-    int __spins;
-    __pthread_list_t __list;
-#define __PTHREAD_MUTEX_HAVE_PREV	1
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
@@ -86,22 +62,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/ia64/nptl/bits/thread-shared-types.h b/sysdeps/ia64/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..d3ffa02
--- /dev/null
+++ b/sysdeps/ia64/nptl/bits/thread-shared-types.h
@@ -0,0 +1,73 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#define __SIZEOF_PTHREAD_MUTEX_T 40
+#define __SIZEOF_PTHREAD_COND_T 48
+
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  unsigned int __nusers;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+  int __spins;
+  __pthread_list_t __list;
+#define __PTHREAD_MUTEX_HAVE_PREV	1
+};
+
+#define __PTHREAD_MUTEX_T_CONTENT             \
+  struct __pthread_mutex_s __data;            \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];      \
+  long int __align;
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes.h b/sysdeps/m68k/nptl/bits/pthreadtypes.h
index 0e2bcdd..fbd704b 100644
--- a/sysdeps/m68k/nptl/bits/pthreadtypes.h
+++ b/sysdeps/m68k/nptl/bits/pthreadtypes.h
@@ -20,11 +20,10 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <endian.h>
+#include <bits/pthreadtypes-common.h>
 
 #define __SIZEOF_PTHREAD_ATTR_T 36
-#define __SIZEOF_PTHREAD_MUTEX_T 24
 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
 #define __SIZEOF_PTHREAD_CONDATTR_T 4
 #define __SIZEOF_PTHREAD_RWLOCK_T 32
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -48,34 +47,8 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is deliberately not exposed.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock __attribute__ ((__aligned__ (4)));
-    unsigned int __count;
-    int __owner;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
@@ -89,22 +62,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    int __lock __attribute__ ((__aligned__ (4)));
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/m68k/nptl/bits/thread-shared-types.h b/sysdeps/m68k/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..2f16125
--- /dev/null
+++ b/sysdeps/m68k/nptl/bits/thread-shared-types.h
@@ -0,0 +1,80 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_COND_T 48
+
+
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock __attribute__ ((__aligned__ (4)));
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+
+
+#define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;        \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
+  long int __align;
+
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock __attribute__ ((__aligned__ (4)));         \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;                    \
+
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes.h b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
index b8bd828..66baf1a 100644
--- a/sysdeps/microblaze/nptl/bits/pthreadtypes.h
+++ b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
@@ -20,11 +20,10 @@ 
 # define _BITS_PTHREADTYPES_H	1
 
 # include <endian.h>
+#include <bits/pthreadtypes-common.h>
 
 # define __SIZEOF_PTHREAD_ATTR_T         36
-# define __SIZEOF_PTHREAD_MUTEX_T        24
 # define __SIZEOF_PTHREAD_MUTEXATTR_T     4
-# define __SIZEOF_PTHREAD_COND_T         48
 # define __SIZEOF_PTHREAD_COND_COMPAT_T  12
 # define __SIZEOF_PTHREAD_CONDATTR_T      4
 # define __SIZEOF_PTHREAD_RWLOCK_T       32
@@ -48,33 +47,9 @@  typedef union pthread_attr_t pthread_attr_t;
 #  define __have_pthread_attr_t	1
 # endif
 
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
 
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
@@ -87,22 +62,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/microblaze/nptl/bits/thread-shared-types.h b/sysdeps/microblaze/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..2fce0f5
--- /dev/null
+++ b/sysdeps/microblaze/nptl/bits/thread-shared-types.h
@@ -0,0 +1,76 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#define __SIZEOF_PTHREAD_MUTEX_T        24
+#define __SIZEOF_PTHREAD_COND_T         48
+
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+
+
+#define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;        \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
+  long int __align;
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/mips/nptl/bits/pthreadtypes.h b/sysdeps/mips/nptl/bits/pthreadtypes.h
index 8cf4547..ea05100 100644
--- a/sysdeps/mips/nptl/bits/pthreadtypes.h
+++ b/sysdeps/mips/nptl/bits/pthreadtypes.h
@@ -20,12 +20,11 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <endian.h>
+#include <bits/pthreadtypes-common.h>
 
 #if _MIPS_SIM == _ABI64
 # define __SIZEOF_PTHREAD_ATTR_T 56
-# define __SIZEOF_PTHREAD_MUTEX_T 40
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 56
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -33,9 +32,7 @@ 
 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 #else
 # define __SIZEOF_PTHREAD_ATTR_T 36
-# define __SIZEOF_PTHREAD_MUTEX_T 24
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 32
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -60,51 +57,8 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-#if _MIPS_SIM == _ABI64
-typedef struct __pthread_internal_list
-{
-  struct __pthread_internal_list *__prev;
-  struct __pthread_internal_list *__next;
-} __pthread_list_t;
-#else
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-#endif
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is deliberately not exposed.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-#if _MIPS_SIM == _ABI64
-    unsigned int __nusers;
-#endif
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-#if _MIPS_SIM == _ABI64
-    int __spins;
-    __pthread_list_t __list;
-# define __PTHREAD_MUTEX_HAVE_PREV	1
-#else
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-#endif
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
@@ -118,22 +72,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/mips/nptl/bits/thread-shared-types.h b/sysdeps/mips/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..b7a254e
--- /dev/null
+++ b/sysdeps/mips/nptl/bits/thread-shared-types.h
@@ -0,0 +1,99 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#if _MIPS_SIM == _ABI64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_COND_T 48
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_COND_T 48
+#endif
+
+#if _MIPS_SIM == _ABI64
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+#else
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+#endif
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if _MIPS_SIM == _ABI64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+#if _MIPS_SIM == _ABI64
+  int __spins;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV	1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+#endif
+};
+
+
+# define __PTHREAD_MUTEX_T_CONTENT         \
+  struct pthread_mutex_s __data;           \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];   \
+  long int __align;
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes.h b/sysdeps/nios2/nptl/bits/pthreadtypes.h
index 4a20803..cf689bc 100644
--- a/sysdeps/nios2/nptl/bits/pthreadtypes.h
+++ b/sysdeps/nios2/nptl/bits/pthreadtypes.h
@@ -20,11 +20,10 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <endian.h>
+#include <bits/pthreadtypes-common.h>
 
 #define __SIZEOF_PTHREAD_ATTR_T 36
-#define __SIZEOF_PTHREAD_MUTEX_T 24
 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
 #define __SIZEOF_PTHREAD_CONDATTR_T 4
 #define __SIZEOF_PTHREAD_RWLOCK_T 32
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -48,34 +47,8 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is deliberately not exposed.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 typedef union
 {
@@ -89,22 +62,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/nios2/nptl/bits/thread-shared-types.h b/sysdeps/nios2/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..586de33
--- /dev/null
+++ b/sysdeps/nios2/nptl/bits/thread-shared-types.h
@@ -0,0 +1,77 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_COND_T 48
+
+
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+
+
+#define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;        \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
+  long int __align;
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/s390/nptl/bits/pthreadtypes.h b/sysdeps/s390/nptl/bits/pthreadtypes.h
index 1f3bb14..ab52671 100644
--- a/sysdeps/s390/nptl/bits/pthreadtypes.h
+++ b/sysdeps/s390/nptl/bits/pthreadtypes.h
@@ -19,12 +19,11 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <bits/wordsize.h>
+#include <bits/pthreadtypes-common.h>
 
 #if __WORDSIZE == 64
 # define __SIZEOF_PTHREAD_ATTR_T 56
-# define __SIZEOF_PTHREAD_MUTEX_T 40
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 56
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -32,9 +31,7 @@ 
 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 #else
 # define __SIZEOF_PTHREAD_ATTR_T 36
-# define __SIZEOF_PTHREAD_MUTEX_T 24
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 32
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -59,75 +56,8 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-#if __WORDSIZE == 64
-typedef struct __pthread_internal_list
-{
-  struct __pthread_internal_list *__prev;
-  struct __pthread_internal_list *__next;
-} __pthread_list_t;
-#else
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-#endif
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-#if __WORDSIZE == 64
-    unsigned int __nusers;
-#endif
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-#if __WORDSIZE == 64
-# ifdef ENABLE_LOCK_ELISION
-    short __spins;
-    short __elision;
-    /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-#  define __PTHREAD_SPINS               0, 0
-# else
-    int __spins;
-    /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-#  define __PTHREAD_SPINS               0
-# endif
-    __pthread_list_t __list;
-# define __PTHREAD_MUTEX_HAVE_PREV	1
-#else
-    unsigned int __nusers;
-    __extension__ union
-    {
-# ifdef ENABLE_LOCK_ELISION
-      struct
-      {
-	short __espins;
-	short __elision;
-      } _d;
-#  define __spins _d.__espins
-#  define __elision _d.__elision
-    /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-#  define __PTHREAD_SPINS               { 0, 0 }
-# else
-      int __spins;
-    /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-#  define __PTHREAD_SPINS               0
-# endif
-      __pthread_slist_t __list;
-    };
-#endif
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
-
 
 typedef union
 {
@@ -138,22 +68,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
@@ -244,5 +158,4 @@  typedef union
 } pthread_barrierattr_t;
 #endif
 
-
 #endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/s390/nptl/bits/thread-shared-types.h b/sysdeps/s390/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..36dd0af
--- /dev/null
+++ b/sysdeps/s390/nptl/bits/thread-shared-types.h
@@ -0,0 +1,123 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_COND_T 48
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_COND_T 48
+#endif
+
+#if __WORDSIZE == 64
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+#else
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+#endif
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if __WORDSIZE == 64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+#if __WORDSIZE == 64
+# ifdef ENABLE_LOCK_ELISION
+  short __spins;
+  short __elision;
+  /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
+#  define __PTHREAD_SPINS               0, 0
+# else
+  int __spins;
+  /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
+#  define __PTHREAD_SPINS               0
+# endif
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV	1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+# ifdef ENABLE_LOCK_ELISION
+    struct
+    {
+      short __espins;
+      short __elision;
+    } _d;
+#  define __spins _d.__espins
+#  define __elision _d.__elision
+  /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
+#  define __PTHREAD_SPINS               { 0, 0 }
+# else
+    int __spins;
+  /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
+#  define __PTHREAD_SPINS               0
+# endif
+    __pthread_slist_t __list;
+  };
+#endif
+};
+
+#define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;        \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
+  long int __align;
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/sh/nptl/bits/pthreadtypes.h b/sysdeps/sh/nptl/bits/pthreadtypes.h
index 5940232..f6df351 100644
--- a/sysdeps/sh/nptl/bits/pthreadtypes.h
+++ b/sysdeps/sh/nptl/bits/pthreadtypes.h
@@ -19,11 +19,10 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <endian.h>
+#include <bits/pthreadtypes-common.h>
 
 #define __SIZEOF_PTHREAD_ATTR_T 36
-#define __SIZEOF_PTHREAD_MUTEX_T 24
 #define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
 #define __SIZEOF_PTHREAD_COND_COMPAT_T 12
 #define __SIZEOF_PTHREAD_CONDATTR_T 4
 #define __SIZEOF_PTHREAD_RWLOCK_T 32
@@ -48,34 +47,8 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
@@ -89,22 +62,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/sh/nptl/bits/thread-shared-types.h b/sysdeps/sh/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..3f4cf8e
--- /dev/null
+++ b/sysdeps/sh/nptl/bits/thread-shared-types.h
@@ -0,0 +1,78 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#include <bits/wordsize.h>
+
+#define __SIZEOF_PTHREAD_MUTEX_T 24
+#define __SIZEOF_PTHREAD_COND_T 48
+
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+};
+
+#define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;         \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];   \
+  long int __align;                       
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes.h b/sysdeps/sparc/nptl/bits/pthreadtypes.h
index 6faf8b2..f787256 100644
--- a/sysdeps/sparc/nptl/bits/pthreadtypes.h
+++ b/sysdeps/sparc/nptl/bits/pthreadtypes.h
@@ -20,12 +20,11 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <bits/wordsize.h>
+#include <bits/pthreadtypes-common.h>
 
 #if __WORDSIZE == 64
 # define __SIZEOF_PTHREAD_ATTR_T 56
-# define __SIZEOF_PTHREAD_MUTEX_T 40
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 56
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -33,9 +32,7 @@ 
 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 #else
 # define __SIZEOF_PTHREAD_ATTR_T 36
-# define __SIZEOF_PTHREAD_MUTEX_T 24
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 32
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -60,51 +57,8 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-#if __WORDSIZE == 64
-typedef struct __pthread_internal_list
-{
-  struct __pthread_internal_list *__prev;
-  struct __pthread_internal_list *__next;
-} __pthread_list_t;
-#else
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-#endif
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is deliberately not exposed.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-#if __WORDSIZE == 64
-    unsigned int __nusers;
-#endif
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-#if __WORDSIZE == 64
-    int __spins;
-    __pthread_list_t __list;
-# define __PTHREAD_MUTEX_HAVE_PREV	1
-#else
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-#endif
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
@@ -118,22 +72,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/sparc/nptl/bits/thread-shared-types.h b/sysdeps/sparc/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..828770d
--- /dev/null
+++ b/sysdeps/sparc/nptl/bits/thread-shared-types.h
@@ -0,0 +1,103 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#include <bits/wordsize.h>
+
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_COND_T 48
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_COND_T 48
+#endif
+
+#if __WORDSIZE == 64
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+#else
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+#endif
+
+
+/* Data structure for mutex handling. */
+
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if __WORDSIZE == 64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+#if __WORDSIZE == 64
+  int __spins;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV	1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+#endif
+};
+
+# define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;           \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];   \
+  long int __align;                       
+
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/tile/nptl/bits/pthreadtypes.h b/sysdeps/tile/nptl/bits/pthreadtypes.h
index 1f6553d..2c102e7 100644
--- a/sysdeps/tile/nptl/bits/pthreadtypes.h
+++ b/sysdeps/tile/nptl/bits/pthreadtypes.h
@@ -21,12 +21,11 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <bits/wordsize.h>
+#include <bits/pthreadtypes-common.h>
 
 #if __WORDSIZE == 64
 # define __SIZEOF_PTHREAD_ATTR_T 56
-# define __SIZEOF_PTHREAD_MUTEX_T 40
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 56
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -34,9 +33,7 @@ 
 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 #else
 # define __SIZEOF_PTHREAD_ATTR_T 36
-# define __SIZEOF_PTHREAD_MUTEX_T 24
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 32
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -60,51 +57,9 @@  typedef union pthread_attr_t pthread_attr_t;
 # define __have_pthread_attr_t	1
 #endif
 
-#if __WORDSIZE == 64
-typedef struct __pthread_internal_list
-{
-  struct __pthread_internal_list *__prev;
-  struct __pthread_internal_list *__next;
-} __pthread_list_t;
-#else
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-#endif
-
 
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-#if __WORDSIZE == 64
-    unsigned int __nusers;
-#endif
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-#if __WORDSIZE == 64
-    int __spins;
-    __pthread_list_t __list;
-# define __PTHREAD_MUTEX_HAVE_PREV	1
-#else
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-#endif
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 typedef union
 {
@@ -118,22 +73,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/tile/nptl/bits/thread-shared-types.h b/sysdeps/tile/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..494e374
--- /dev/null
+++ b/sysdeps/tile/nptl/bits/thread-shared-types.h
@@ -0,0 +1,101 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#include <bits/wordsize.h>
+
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_COND_T 48
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_COND_T 48
+#endif
+
+#if __WORDSIZE == 64
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+#else
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+#endif
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if __WORDSIZE == 64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+#if __WORDSIZE == 64
+  int __spins;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV	1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    int __spins;
+    __pthread_slist_t __list;
+  };
+#endif
+};
+
+#define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;        \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];  \
+  long int __align;
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
index 7121d0b..41dc525 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h
@@ -19,10 +19,10 @@ 
 #ifndef _BITS_PTHREADTYPES_H
 #define _BITS_PTHREADTYPES_H	1
 
+#include <bits/pthreadtypes-common.h>
+
 #define __SIZEOF_PTHREAD_ATTR_T		56
-#define __SIZEOF_PTHREAD_MUTEX_T	40
 #define __SIZEOF_PTHREAD_MUTEXATTR_T	4
-#define __SIZEOF_PTHREAD_COND_T		48
 #define __SIZEOF_PTHREAD_CONDATTR_T	4
 #define __SIZEOF_PTHREAD_RWLOCK_T	56
 #define __SIZEOF_PTHREAD_RWLOCKATTR_T	8
@@ -45,33 +45,9 @@  typedef union pthread_attr_t pthread_attr_t;
 # define __have_pthread_attr_t	1
 #endif
 
-typedef struct __pthread_internal_list
-{
-  struct __pthread_internal_list *__prev;
-  struct __pthread_internal_list *__next;
-} __pthread_list_t;
-
 
 /* Data structures for mutex handling.  The structure of the attribute
    type is deliberately not exposed.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-    unsigned int __nusers;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-    int __spins;
-    __pthread_list_t __list;
-#define __PTHREAD_MUTEX_HAVE_PREV	1
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
 #define __PTHREAD_SPINS 0
@@ -85,22 +61,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/thread-shared-types.h b/sysdeps/unix/sysv/linux/alpha/bits/thread-shared-types.h
new file mode 100644
index 0000000..0ee49ca
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/thread-shared-types.h
@@ -0,0 +1,77 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+
+#define __SIZEOF_PTHREAD_MUTEX_T 40
+#define __SIZEOF_PTHREAD_COND_T 48
+
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+  unsigned int __nusers;
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+  int __spins;
+  __pthread_list_t __list;
+#define __PTHREAD_MUTEX_HAVE_PREV	1
+} __data;
+
+
+#define __PTHREAD_MUTEX_T_CONTENT            \
+  struct __pthread_mutex_s __data;            \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];      \
+  long int __align;
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
index 7cbdb2c..fb6e145 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
@@ -20,12 +20,11 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <bits/wordsize.h>
+#include <bits/pthreadtypes-common.h>
 
 #if __WORDSIZE == 64
 # define __SIZEOF_PTHREAD_ATTR_T 56
-# define __SIZEOF_PTHREAD_MUTEX_T 40
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 56
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -33,9 +32,7 @@ 
 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 #else
 # define __SIZEOF_PTHREAD_ATTR_T 36
-# define __SIZEOF_PTHREAD_MUTEX_T 24
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 32
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -76,44 +73,6 @@  typedef struct __pthread_internal_slist
 
 /* Data structures for mutex handling.  The structure of the attribute
    type is deliberately not exposed.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-#if __WORDSIZE == 64
-    unsigned int __nusers;
-#endif
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-#if __WORDSIZE == 64
-    short __spins;
-    short __elision;
-    __pthread_list_t __list;
-# define __PTHREAD_MUTEX_HAVE_PREV	1
-# define __PTHREAD_SPINS             0, 0
-#else
-    unsigned int __nusers;
-    __extension__ union
-    {
-      struct
-      {
-	short __espins;
-	short __elision;
-# define __spins __elision_data.__espins
-# define __elision __elision_data.__elision
-# define __PTHREAD_SPINS         { 0, 0 }
-      } __elision_data;
-      __pthread_slist_t __list;
-    };
-#endif
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 typedef union
 {
@@ -124,22 +83,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/thread-shared-types.h b/sysdeps/unix/sysv/linux/powerpc/bits/thread-shared-types.h
new file mode 100644
index 0000000..ed93e90
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/thread-shared-types.h
@@ -0,0 +1,110 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	1
+
+#include <bits/wordsize.h>
+
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_COND_T 48
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_COND_T 48
+#endif
+
+#if __WORDSIZE == 64
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+#else
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+#endif
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#if __WORDSIZE == 64
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+#if __WORDSIZE == 64
+  short __spins;
+  short __elision;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV	1
+# define __PTHREAD_SPINS             0, 0
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    struct
+    {
+      short __espins;
+      short __elision;
+# define __spins __elision_data.__espins
+# define __elision __elision_data.__elision
+# define __PTHREAD_SPINS         { 0, 0 }
+    } __elision_data;
+    __pthread_slist_t __list;
+  };
+#endif
+};
+
+# define __PTHREAD_MUTEX_T_CONTENT         \
+  struct __pthread_mutex_s __data;           \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];   \
+  long int __align;                       
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */
diff --git a/sysdeps/x86/bits/pthreadtypes.h b/sysdeps/x86/bits/pthreadtypes.h
index 4460615..1b7d567 100644
--- a/sysdeps/x86/bits/pthreadtypes.h
+++ b/sysdeps/x86/bits/pthreadtypes.h
@@ -19,13 +19,12 @@ 
 #define _BITS_PTHREADTYPES_H	1
 
 #include <bits/wordsize.h>
+#include <bits/pthreadtypes-common.h>
 
 #ifdef __x86_64__
 # if __WORDSIZE == 64
 #  define __SIZEOF_PTHREAD_ATTR_T 56
-#  define __SIZEOF_PTHREAD_MUTEX_T 40
 #  define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#  define __SIZEOF_PTHREAD_COND_T 48
 #  define __SIZEOF_PTHREAD_CONDATTR_T 4
 #  define __SIZEOF_PTHREAD_RWLOCK_T 56
 #  define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -33,9 +32,7 @@ 
 #  define __SIZEOF_PTHREAD_BARRIERATTR_T 4
 # else
 #  define __SIZEOF_PTHREAD_ATTR_T 32
-#  define __SIZEOF_PTHREAD_MUTEX_T 32
 #  define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#  define __SIZEOF_PTHREAD_COND_T 48
 #  define __SIZEOF_PTHREAD_CONDATTR_T 4
 #  define __SIZEOF_PTHREAD_RWLOCK_T 44
 #  define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -44,9 +41,7 @@ 
 # endif
 #else
 # define __SIZEOF_PTHREAD_ATTR_T 36
-# define __SIZEOF_PTHREAD_MUTEX_T 24
 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
 # define __SIZEOF_PTHREAD_CONDATTR_T 4
 # define __SIZEOF_PTHREAD_RWLOCK_T 32
 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
@@ -71,61 +66,8 @@  typedef union pthread_attr_t pthread_attr_t;
 #endif
 
 
-#ifdef __x86_64__
-typedef struct __pthread_internal_list
-{
-  struct __pthread_internal_list *__prev;
-  struct __pthread_internal_list *__next;
-} __pthread_list_t;
-#else
-typedef struct __pthread_internal_slist
-{
-  struct __pthread_internal_slist *__next;
-} __pthread_slist_t;
-#endif
-
-
 /* Data structures for mutex handling.  The structure of the attribute
    type is not exposed on purpose.  */
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-#ifdef __x86_64__
-    unsigned int __nusers;
-#endif
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility.  */
-    int __kind;
-#ifdef __x86_64__
-    short __spins;
-    short __elision;
-    __pthread_list_t __list;
-# define __PTHREAD_MUTEX_HAVE_PREV	1
-/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-# define __PTHREAD_SPINS             0, 0
-#else
-    unsigned int __nusers;
-    __extension__ union
-    {
-      struct
-      {
-	short __espins;
-	short __elision;
-# define __spins __elision_data.__espins
-# define __elision __elision_data.__elision
-# define __PTHREAD_SPINS         { 0, 0 }
-      } __elision_data;
-      __pthread_slist_t __list;
-    };
-#endif
-  } __data;
-  char __size[__SIZEOF_PTHREAD_MUTEX_T];
-  long int __align;
-} pthread_mutex_t;
 
 typedef union
 {
@@ -136,22 +78,6 @@  typedef union
 
 /* Data structure for conditional variable handling.  The structure of
    the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    int __lock;
-    unsigned int __futex;
-    __extension__ unsigned long long int __total_seq;
-    __extension__ unsigned long long int __wakeup_seq;
-    __extension__ unsigned long long int __woken_seq;
-    void *__mutex;
-    unsigned int __nwaiters;
-    unsigned int __broadcast_seq;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
 
 typedef union
 {
diff --git a/sysdeps/x86/bits/thread-shared-types.h b/sysdeps/x86/bits/thread-shared-types.h
new file mode 100644
index 0000000..dba6563
--- /dev/null
+++ b/sysdeps/x86/bits/thread-shared-types.h
@@ -0,0 +1,116 @@ 
+/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* This header contains macros definition required for 
+   the declaration of pthread_mutex_t and pthread_cond_t, 
+   both needed by C11 types mtx_t and cnd_t. */
+
+#ifndef _BITS_THREAD_SHARED_TYPES_H
+#define _BITS_THREAD_SHARED_TYPES_H	  1
+
+#include <bits/wordsize.h>
+
+#ifdef __x86_64__
+# if __WORDSIZE == 64
+#  define __SIZEOF_PTHREAD_MUTEX_T 40
+#  define __SIZEOF_PTHREAD_COND_T 48
+# else
+#  define __SIZEOF_PTHREAD_MUTEX_T 32
+#  define __SIZEOF_PTHREAD_COND_T 48
+# endif
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_COND_T 48
+#endif
+
+#ifdef __x86_64__
+typedef struct __pthread_internal_list
+{
+  struct __pthread_internal_list *__prev;
+  struct __pthread_internal_list *__next;
+} __pthread_list_t;
+#else
+typedef struct __pthread_internal_slist
+{
+  struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+#endif
+
+
+/* Data structure for mutex handling. */
+
+struct __pthread_mutex_s
+{
+  int __lock;
+  unsigned int __count;
+  int __owner;
+#ifdef __x86_64__
+  unsigned int __nusers;
+#endif
+  /* KIND must stay at this position in the structure to maintain
+     binary compatibility.  */
+  int __kind;
+#ifdef __x86_64__
+  short __spins;
+  short __elision;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV	1
+/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
+# define __PTHREAD_SPINS             0, 0
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    struct
+    {
+      short __espins;
+      short __elision;
+# define __spins __elision_data.__espins
+# define __elision __elision_data.__elision
+# define __PTHREAD_SPINS         { 0, 0 }
+    } __elision_data;
+    __pthread_slist_t __list;
+  };
+#endif
+};
+
+
+# define __PTHREAD_MUTEX_T_CONTENT            \
+  struct __pthread_mutex_s __data;            \
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];      \
+  long int __align;
+
+
+/* Data structure for conditional variable handling */
+
+#define __PTHREAD_COND_T_CONTENT                          \
+  struct                                                  \
+  {                                                       \
+    int __lock;                                           \
+    unsigned int __futex;                                 \
+    __extension__ unsigned long long int __total_seq;     \
+    __extension__ unsigned long long int __wakeup_seq;    \
+    __extension__ unsigned long long int __woken_seq;     \
+    void *__mutex;                                        \
+    unsigned int __nwaiters;                              \
+    unsigned int __broadcast_seq;                         \
+  } __data;                                               \
+  char __size[__SIZEOF_PTHREAD_COND_T];                   \
+  __extension__ long long int __align;
+
+
+#endif	/* bits/thread-shared-types.h */