diff mbox series

[2/2] Move shared pthread definitions to common headers

Message ID 1491232114-7588-2-git-send-email-adhemerval.zanella@linaro.org
State New
Headers show
Series [1/2] Consolidate pthreadtype.h placement | expand

Commit Message

Adhemerval Zanella April 3, 2017, 3:08 p.m. UTC
This patch removes all the replicated pthread definition accross the
architectures and consolidates it on shared headers.  The new
organization is as follow:

  * Architecture specific definition (such as pthread types sizes) are
    place in the new pthreadtypes-arch.h header in arch specific path.

  * All shared structure definition are moved to a common NPTL header
    at sysdeps/nptl/bits/pthreadtypes.h (with now includes the arch
    specific one for internal definitions).

  * Also, for C11 future thread support, both mutex and conditional
    definition are placed in a common header at
    sysdeps/nptl/bits/thread-shared-types.h.

It is also a refactor patch without expected functional changes.
Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,
m68k-linux-gnu, microblaze-linux-gnu, mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).
---
 ChangeLog                                        |  40 ++++
 posix/Makefile                                   |   1 +
 sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h    |  70 ++++++
 sysdeps/aarch64/nptl/bits/pthreadtypes.h         | 203 -----------------
 sysdeps/alpha/nptl/bits/pthreadtypes-arch.h      |  59 +++++
 sysdeps/alpha/nptl/bits/pthreadtypes.h           | 188 ----------------
 sysdeps/arm/nptl/bits/pthreadtypes-arch.h        |  70 ++++++
 sysdeps/arm/nptl/bits/pthreadtypes.h             | 202 -----------------
 sysdeps/hppa/nptl/bits/pthreadtypes-arch.h       |  90 ++++++++
 sysdeps/hppa/nptl/bits/pthreadtypes.h            | 230 -------------------
 sysdeps/ia64/nptl/bits/pthreadtypes-arch.h       |  61 +++++
 sysdeps/m68k/nptl/bits/pthreadtypes-arch.h       |  61 +++++
 sysdeps/m68k/nptl/bits/pthreadtypes.h            | 194 ----------------
 sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h |  71 ++++++
 sysdeps/microblaze/nptl/bits/pthreadtypes.h      | 194 ----------------
 sysdeps/mips/nptl/bits/pthreadtypes-arch.h       |  87 ++++++++
 sysdeps/mips/nptl/bits/pthreadtypes.h            | 250 ---------------------
 sysdeps/nios2/nptl/bits/pthreadtypes-arch.h      |  70 ++++++
 sysdeps/nios2/nptl/bits/pthreadtypes.h           | 202 -----------------
 sysdeps/{ia64 => }/nptl/bits/pthreadtypes.h      | 141 +++---------
 sysdeps/nptl/bits/thread-shared-types.h          | 121 ++++++++++
 sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h    |  79 +++++++
 sysdeps/powerpc/nptl/bits/pthreadtypes.h         | 249 ---------------------
 sysdeps/s390/nptl/bits/pthreadtypes-arch.h       |  81 +++++++
 sysdeps/s390/nptl/bits/pthreadtypes.h            | 261 ----------------------
 sysdeps/sh/nptl/bits/pthreadtypes-arch.h         |  70 ++++++
 sysdeps/sh/nptl/bits/pthreadtypes.h              | 202 -----------------
 sysdeps/sparc/nptl/bits/pthreadtypes-arch.h      |  79 +++++++
 sysdeps/sparc/nptl/bits/pthreadtypes.h           | 241 --------------------
 sysdeps/tile/nptl/bits/pthreadtypes-arch.h       |  79 +++++++
 sysdeps/tile/nptl/bits/pthreadtypes.h            | 241 --------------------
 sysdeps/x86/nptl/bits/pthreadtypes-arch.h        |  99 +++++++++
 sysdeps/x86/nptl/bits/pthreadtypes.h             | 271 -----------------------
 33 files changed, 1324 insertions(+), 3233 deletions(-)
 create mode 100644 sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/aarch64/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/alpha/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/arm/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/arm/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/hppa/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
 create mode 100644 sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/m68k/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/microblaze/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/mips/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/mips/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/nios2/nptl/bits/pthreadtypes.h
 rename sysdeps/{ia64 => }/nptl/bits/pthreadtypes.h (53%)
 create mode 100644 sysdeps/nptl/bits/thread-shared-types.h
 create mode 100644 sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/powerpc/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/s390/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/s390/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/sh/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/sh/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/sparc/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/tile/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/tile/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/x86/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/x86/nptl/bits/pthreadtypes.h

-- 
2.7.4

Comments

Adhemerval Zanella April 10, 2017, 6:22 p.m. UTC | #1
On 03/04/2017 12:08, Adhemerval Zanella wrote:
> This patch removes all the replicated pthread definition accross the

> architectures and consolidates it on shared headers.  The new

> organization is as follow:

> 

>   * Architecture specific definition (such as pthread types sizes) are

>     place in the new pthreadtypes-arch.h header in arch specific path.

> 

>   * All shared structure definition are moved to a common NPTL header

>     at sysdeps/nptl/bits/pthreadtypes.h (with now includes the arch

>     specific one for internal definitions).

> 

>   * Also, for C11 future thread support, both mutex and conditional

>     definition are placed in a common header at

>     sysdeps/nptl/bits/thread-shared-types.h.


Ping.  It is mostly a mechanical refactor without no expected code changes
and I would like to push so I can rebase the C11 thread patch on top of
it.
Torvald Riegel April 18, 2017, 11:32 a.m. UTC | #2
On Mon, 2017-04-03 at 12:08 -0300, Adhemerval Zanella wrote:
> This patch removes all the replicated pthread definition accross the

> architectures and consolidates it on shared headers.  The new

> organization is as follow:

> 

>   * Architecture specific definition (such as pthread types sizes) are

>     place in the new pthreadtypes-arch.h header in arch specific path.

> 

>   * All shared structure definition are moved to a common NPTL header

>     at sysdeps/nptl/bits/pthreadtypes.h (with now includes the arch

>     specific one for internal definitions).

> 

>   * Also, for C11 future thread support, both mutex and conditional

>     definition are placed in a common header at

>     sysdeps/nptl/bits/thread-shared-types.h.

> 

> It is also a refactor patch without expected functional changes.

> Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,

> arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,

> m68k-linux-gnu, microblaze-linux-gnu, mips{64}-linux-gnu, nios2-linux-gnu,

> powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,

> tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).


OK with the changes below.

Patch 1/2 is OK.

> ---

> diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/nptl/bits/pthreadtypes.h

> similarity index 53%

> rename from sysdeps/ia64/nptl/bits/pthreadtypes.h

> rename to sysdeps/nptl/bits/pthreadtypes.h

> index c67ee86..6348cf5 100644

> --- a/sysdeps/ia64/nptl/bits/pthreadtypes.h

> +++ b/sysdeps/nptl/bits/pthreadtypes.h

> @@ -1,6 +1,6 @@

> -/* Copyright (C) 2003-2017 Free Software Foundation, Inc.

> +/* Declaration of common pthread types for all architectures.

> +   Copyright (C) 2017 Free Software Foundation, Inc.

>     This file is part of the GNU C Library.

> -   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.

>  

>     The GNU C Library is free software; you can redistribute it and/or

>     modify it under the terms of the GNU Lesser General Public

> @@ -16,69 +16,21 @@

>     License along with the GNU C Library; if not, see

>     <http://www.gnu.org/licenses/>.  */

>  

> -#ifndef _BITS_PTHREADTYPES_H

> -#define _BITS_PTHREADTYPES_H	1

> -

> -#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

> -#define __SIZEOF_PTHREAD_BARRIER_T 32

> -#define __SIZEOF_PTHREAD_BARRIERATTR_T 4

> +#ifndef _BITS_PTHREADTYPES_COMMON_H

> +# define _BITS_PTHREADTYPES_COMMON_H	1

>  

> +/* For internal mutex and conditional definitions.  */


s/conditional/condition variable/

> @@ -131,33 +53,43 @@ typedef unsigned int pthread_key_t;

>  typedef int pthread_once_t;

>  

> 

> +union pthread_attr_t

> +{

> +  char __size[__SIZEOF_PTHREAD_ATTR_T];

> +  long int __align;

> +};

> +#ifndef __have_pthread_attr_t

> +typedef union pthread_attr_t pthread_attr_t;

> +# define __have_pthread_attr_t1

> +#endif

> +

> +

> +typedef union

> +{

> +  struct __pthread_mutex_s __data;

> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];

> +  long int __align;

> +} pthread_mutex_t;

> +

> +

> +typedef union

> +{

> +  struct __pthread_cond_s __data;

> +  char __size[__SIZEOF_PTHREAD_COND_T];

> +  __extension__ long long int __align;

> +} pthread_cond_t;

> +

> +

>  #if defined __USE_UNIX98 || defined __USE_XOPEN2K

>  /* Data structure for read-write lock variable handling.  The


s/read-write/reader--writer/

> -   structure of the attribute type is not exposed on purpose.  */

> +   structure of the attribute type is deliberately not exposed.  */

>  typedef union

>  {

> -  struct

> -  {

> -    unsigned int __readers;

> -    unsigned int __writers;

> -    unsigned int __wrphase_futex;

> -    unsigned int __writers_futex;

> -    unsigned int __pad3;

> -    unsigned int __pad4;

> -    int __cur_writer;

> -    int __shared;

> -    unsigned long int __pad1;

> -    unsigned long int __pad2;

> -    /* FLAGS must stay at this position in the structure to maintain

> -       binary compatibility.  */

> -    unsigned int __flags;

> -  } __data;

> +  struct __pthread_rwlock_arch_t __data;

>    char __size[__SIZEOF_PTHREAD_RWLOCK_T];

>    long int __align;

>  } pthread_rwlock_t;

>  

> -#define __PTHREAD_RWLOCK_ELISION_EXTRA 0

> -

>  typedef union

>  {

>    char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];

> @@ -186,5 +118,4 @@ typedef union

>  } pthread_barrierattr_t;

>  #endif

>  

> -

> -#endif	/* bits/pthreadtypes.h */

> +#endif

> diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h

> new file mode 100644

> index 0000000..82085f1

> --- /dev/null

> +++ b/sysdeps/nptl/bits/thread-shared-types.h

> @@ -0,0 +1,121 @@

> +/* Common thread definition for both POSIX and C11.


s/thread definition/threading primitives definitions/

> +   Copyright (C) 2017 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/>.  */

> +

> +#ifndef _THREAD_SHARED_TYPES_H

> +#define _THREAD_SHARED_TYPES_H 1

> +

> +/* Arch-specific definitions.  */

> +#include <bits/pthreadtypes-arch.h>

> +

> +/* Common definition of pthread_mutex_t. */

> +

> +#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

> +

> +/* Lock elision support.  */

> +#if __PTHREAD_MUTEX_LOCK_ELISION

> +# if __WORDSIZE == 64

> +#  define __PTHREAD_SPINS_DATA	\

> +  short __spins;		\

> +  short __elision;

> +#  define __PTHREAD_SPINS             0, 0

> +# else

> +#  define __PTHREAD_SPINS_DATA	\

> +  struct			\

> +  {				\

> +    short __espins;		\

> +    short __eelision;		\

> +  } __elision_data

> +#  define __PTHREAD_SPINS         { 0, 0 }

> +#  define __spins __elision_data.__espins

> +#  define __elision __elision_data.__eelision


These two macros seem rather risky to me.  Is there another way to make
this work?  For which archs would struct vs. fields make a difference in
terms of alignment etc?

> +# endif

> +#else

> +# define __PTHREAD_SPINS_DATA int __spins

> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */

> +# define __PTHREAD_SPINS 0

> +#endif


Likewise, and you don't undefined __spins and __elision

> +

> +struct __pthread_mutex_s

> +{ 

> +  int __lock __PTHREAD_LOCK_ALIGNMENT;

> +  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 with static initializers.  */

> +  int __kind;

> +  __PTHREAD_COMPAT_PADDING_MID;

> +#if __WORDSIZE == 64

> +  __PTHREAD_SPINS_DATA;

> +  __pthread_list_t __list;

> +# define __PTHREAD_MUTEX_HAVE_PREV      1

> +#else

> +  unsigned int __nusers;

> +  __extension__ union

> +  {

> +    __PTHREAD_SPINS_DATA;

> +    __pthread_slist_t __list;

> +  }

> +#endif

> +  __PTHREAD_COMPAT_PADDING_END;

> +};

> +

> +

> +/* Common definition of pthread_cond_t. */

> +

> +struct __pthread_cond_s

> +{ 

> +  __extension__ union

> +  {

> +    __extension__ unsigned long long int __wseq;

> +    struct

> +    {

> +      unsigned int __low;

> +      unsigned int __high;

> +    } __wseq32;

> +  };

> +  __extension__ union

> +  {

> +    __extension__ unsigned long long int __g1_start;

> +    struct

> +    {

> +      unsigned int __low;

> +      unsigned int __high;

> +    } __g1_start32;

> +  };

> +  unsigned int __g_refs[2] __PTHREAD_LOCK_ALIGNMENT;


If __PTHREAD_LOCK_ALIGNMENT is not just for locks, but more generally
captures alignment requirements for futex words, I think it should be
named differently, and there should be a comment somewhere explaining
it's use.  This is probably also the case for the other macros that this
file uses (though perhaps the __SIZEOF_PTHREAD_* macros are
self-explainatory).  A stub pthreadtypes-arch.h may be a way to do it,
though I'm not sure this works as well in this case as it works in the
case of futex-internal.h.

> +  unsigned int __g_size[2];

> +  unsigned int __g1_orig_size;

> +  unsigned int __wrefs;

> +  unsigned int __g_signals[2];

> +};

> +

> +#endif /* _THREAD_SHARED_TYPES_H  */
Adhemerval Zanella April 18, 2017, 1:08 p.m. UTC | #3
Thanks for the review.

On 18/04/2017 08:32, Torvald Riegel wrote:
> On Mon, 2017-04-03 at 12:08 -0300, Adhemerval Zanella wrote:

>> This patch removes all the replicated pthread definition accross the

>> architectures and consolidates it on shared headers.  The new

>> organization is as follow:

>>

>>   * Architecture specific definition (such as pthread types sizes) are

>>     place in the new pthreadtypes-arch.h header in arch specific path.

>>

>>   * All shared structure definition are moved to a common NPTL header

>>     at sysdeps/nptl/bits/pthreadtypes.h (with now includes the arch

>>     specific one for internal definitions).

>>

>>   * Also, for C11 future thread support, both mutex and conditional

>>     definition are placed in a common header at

>>     sysdeps/nptl/bits/thread-shared-types.h.

>>

>> It is also a refactor patch without expected functional changes.

>> Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,

>> arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,

>> m68k-linux-gnu, microblaze-linux-gnu, mips{64}-linux-gnu, nios2-linux-gnu,

>> powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,

>> tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).

> 

> OK with the changes below.

> 

> Patch 1/2 is OK.

> 

>> ---

>> diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/nptl/bits/pthreadtypes.h

>> similarity index 53%

>> rename from sysdeps/ia64/nptl/bits/pthreadtypes.h

>> rename to sysdeps/nptl/bits/pthreadtypes.h

>> index c67ee86..6348cf5 100644

>> --- a/sysdeps/ia64/nptl/bits/pthreadtypes.h

>> +++ b/sysdeps/nptl/bits/pthreadtypes.h

>> @@ -1,6 +1,6 @@

>> -/* Copyright (C) 2003-2017 Free Software Foundation, Inc.

>> +/* Declaration of common pthread types for all architectures.

>> +   Copyright (C) 2017 Free Software Foundation, Inc.

>>     This file is part of the GNU C Library.

>> -   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.

>>  

>>     The GNU C Library is free software; you can redistribute it and/or

>>     modify it under the terms of the GNU Lesser General Public

>> @@ -16,69 +16,21 @@

>>     License along with the GNU C Library; if not, see

>>     <http://www.gnu.org/licenses/>.  */

>>  

>> -#ifndef _BITS_PTHREADTYPES_H

>> -#define _BITS_PTHREADTYPES_H	1

>> -

>> -#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

>> -#define __SIZEOF_PTHREAD_BARRIER_T 32

>> -#define __SIZEOF_PTHREAD_BARRIERATTR_T 4

>> +#ifndef _BITS_PTHREADTYPES_COMMON_H

>> +# define _BITS_PTHREADTYPES_COMMON_H	1

>>  

>> +/* For internal mutex and conditional definitions.  */

> 

> s/conditional/condition variable/


Ack.

> 

>> @@ -131,33 +53,43 @@ typedef unsigned int pthread_key_t;

>>  typedef int pthread_once_t;

>>  

>>

>> +union pthread_attr_t

>> +{

>> +  char __size[__SIZEOF_PTHREAD_ATTR_T];

>> +  long int __align;

>> +};

>> +#ifndef __have_pthread_attr_t

>> +typedef union pthread_attr_t pthread_attr_t;

>> +# define __have_pthread_attr_t1

>> +#endif

>> +

>> +

>> +typedef union

>> +{

>> +  struct __pthread_mutex_s __data;

>> +  char __size[__SIZEOF_PTHREAD_MUTEX_T];

>> +  long int __align;

>> +} pthread_mutex_t;

>> +

>> +

>> +typedef union

>> +{

>> +  struct __pthread_cond_s __data;

>> +  char __size[__SIZEOF_PTHREAD_COND_T];

>> +  __extension__ long long int __align;

>> +} pthread_cond_t;

>> +

>> +

>>  #if defined __USE_UNIX98 || defined __USE_XOPEN2K

>>  /* Data structure for read-write lock variable handling.  The

> 

> s/read-write/reader--writer/


Ack.

> 

>> -   structure of the attribute type is not exposed on purpose.  */

>> +   structure of the attribute type is deliberately not exposed.  */

>>  typedef union

>>  {

>> -  struct

>> -  {

>> -    unsigned int __readers;

>> -    unsigned int __writers;

>> -    unsigned int __wrphase_futex;

>> -    unsigned int __writers_futex;

>> -    unsigned int __pad3;

>> -    unsigned int __pad4;

>> -    int __cur_writer;

>> -    int __shared;

>> -    unsigned long int __pad1;

>> -    unsigned long int __pad2;

>> -    /* FLAGS must stay at this position in the structure to maintain

>> -       binary compatibility.  */

>> -    unsigned int __flags;

>> -  } __data;

>> +  struct __pthread_rwlock_arch_t __data;

>>    char __size[__SIZEOF_PTHREAD_RWLOCK_T];

>>    long int __align;

>>  } pthread_rwlock_t;

>>  

>> -#define __PTHREAD_RWLOCK_ELISION_EXTRA 0

>> -

>>  typedef union

>>  {

>>    char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];

>> @@ -186,5 +118,4 @@ typedef union

>>  } pthread_barrierattr_t;

>>  #endif

>>  

>> -

>> -#endif	/* bits/pthreadtypes.h */

>> +#endif

>> diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h

>> new file mode 100644

>> index 0000000..82085f1

>> --- /dev/null

>> +++ b/sysdeps/nptl/bits/thread-shared-types.h

>> @@ -0,0 +1,121 @@

>> +/* Common thread definition for both POSIX and C11.

> 

> s/thread definition/threading primitives definitions/


Ack.

> 

>> +   Copyright (C) 2017 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/>.  */

>> +

>> +#ifndef _THREAD_SHARED_TYPES_H

>> +#define _THREAD_SHARED_TYPES_H 1

>> +

>> +/* Arch-specific definitions.  */

>> +#include <bits/pthreadtypes-arch.h>

>> +

>> +/* Common definition of pthread_mutex_t. */

>> +

>> +#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

>> +

>> +/* Lock elision support.  */

>> +#if __PTHREAD_MUTEX_LOCK_ELISION

>> +# if __WORDSIZE == 64

>> +#  define __PTHREAD_SPINS_DATA	\

>> +  short __spins;		\

>> +  short __elision;

>> +#  define __PTHREAD_SPINS             0, 0

>> +# else

>> +#  define __PTHREAD_SPINS_DATA	\

>> +  struct			\

>> +  {				\

>> +    short __espins;		\

>> +    short __eelision;		\

>> +  } __elision_data

>> +#  define __PTHREAD_SPINS         { 0, 0 }

>> +#  define __spins __elision_data.__espins

>> +#  define __elision __elision_data.__eelision

> 

> These two macros seem rather risky to me.  Is there another way to make

> this work?  For which archs would struct vs. fields make a difference in

> terms of alignment etc?


For this consolidation I replicated current architecture code that uses
lock elision (they differ only in the internal struct's name and all use
the macro for accessing the fields).

Another option would to move the elision field definition at each
architecture specific header (pthreadtypes-arch.h), so it can guarantee
any alignment or other constraint. I do not have a preference here, so
if you would prefer this approach I can change the patch.

> 

>> +# endif

>> +#else

>> +# define __PTHREAD_SPINS_DATA int __spins

>> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */

>> +# define __PTHREAD_SPINS 0

>> +#endif

> 

> Likewise, and you don't undefined __spins and __elision


The idea is __spins will be define by __PTHREAD_SPINS_DATA and since this
snippet will be defined iff the architecture explicit do not support lock
elision, using __elision field should and will thrown a compilation error.

> 

>> +

>> +struct __pthread_mutex_s

>> +{ 

>> +  int __lock __PTHREAD_LOCK_ALIGNMENT;

>> +  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 with static initializers.  */

>> +  int __kind;

>> +  __PTHREAD_COMPAT_PADDING_MID;

>> +#if __WORDSIZE == 64

>> +  __PTHREAD_SPINS_DATA;

>> +  __pthread_list_t __list;

>> +# define __PTHREAD_MUTEX_HAVE_PREV      1

>> +#else

>> +  unsigned int __nusers;

>> +  __extension__ union

>> +  {

>> +    __PTHREAD_SPINS_DATA;

>> +    __pthread_slist_t __list;

>> +  }

>> +#endif

>> +  __PTHREAD_COMPAT_PADDING_END;

>> +};

>> +

>> +

>> +/* Common definition of pthread_cond_t. */

>> +

>> +struct __pthread_cond_s

>> +{ 

>> +  __extension__ union

>> +  {

>> +    __extension__ unsigned long long int __wseq;

>> +    struct

>> +    {

>> +      unsigned int __low;

>> +      unsigned int __high;

>> +    } __wseq32;

>> +  };

>> +  __extension__ union

>> +  {

>> +    __extension__ unsigned long long int __g1_start;

>> +    struct

>> +    {

>> +      unsigned int __low;

>> +      unsigned int __high;

>> +    } __g1_start32;

>> +  };

>> +  unsigned int __g_refs[2] __PTHREAD_LOCK_ALIGNMENT;

> 

> If __PTHREAD_LOCK_ALIGNMENT is not just for locks, but more generally

> captures alignment requirements for futex words, I think it should be

> named differently, and there should be a comment somewhere explaining

> it's use.  This is probably also the case for the other macros that this

> file uses (though perhaps the __SIZEOF_PTHREAD_* macros are

> self-explainatory).  A stub pthreadtypes-arch.h may be a way to do it,

> though I'm not sure this works as well in this case as it works in the

> case of futex-internal.h.


I think we can use pthreadtypes-arch.h, the idea is exactly to grab all
the arch specific constraint and it should be an installed header.
Otherwise we will need to create another installed header to have this
definition and I am not sure if this is worth.

In any way, I will change the macro name to __LOCK_ALIGNMENT and I will
add comments on sysdeps/nptl/bits/thread-shared-types.h explaining the
requires defines the arch-specific header should have (__LOCK_ALIGNMENT,
__PTHREAD_COMPAT_PADDING_MID, __PTHREAD_COMPAT_PADDING_END, and
__PTHREAD_MUTEX_LOCK_ELISION).

> 

>> +  unsigned int __g_size[2];

>> +  unsigned int __g1_orig_size;

>> +  unsigned int __wrefs;

>> +  unsigned int __g_signals[2];

>> +};

>> +

>> +#endif /* _THREAD_SHARED_TYPES_H  */

>
Adhemerval Zanella May 9, 2017, 3:10 p.m. UTC | #4
On 18/04/2017 10:08, Adhemerval Zanella wrote:
> Thanks for the review.

> 

> On 18/04/2017 08:32, Torvald Riegel wrote:

>> On Mon, 2017-04-03 at 12:08 -0300, Adhemerval Zanella wrote:

>>> This patch removes all the replicated pthread definition accross the

>>> architectures and consolidates it on shared headers.  The new

>>> organization is as follow:

>>>

>>>   * Architecture specific definition (such as pthread types sizes) are

>>>     place in the new pthreadtypes-arch.h header in arch specific path.

>>>

>>>   * All shared structure definition are moved to a common NPTL header

>>>     at sysdeps/nptl/bits/pthreadtypes.h (with now includes the arch

>>>     specific one for internal definitions).

>>>

>>>   * Also, for C11 future thread support, both mutex and conditional

>>>     definition are placed in a common header at

>>>     sysdeps/nptl/bits/thread-shared-types.h.

>>>

>>> It is also a refactor patch without expected functional changes.

>>> Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,

>>> arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,

>>> m68k-linux-gnu, microblaze-linux-gnu, mips{64}-linux-gnu, nios2-linux-gnu,

>>> powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,

>>> tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).

>>

>> OK with the changes below.

>>


This is the patch I intend to push, I just finishing up the build on multiple
architecture to grab any missing issue.  I fixed the wording you pointed out
in previous review.

> 

> For this consolidation I replicated current architecture code that uses

> lock elision (they differ only in the internal struct's name and all use

> the macro for accessing the fields).

> 

> Another option would to move the elision field definition at each

> architecture specific header (pthreadtypes-arch.h), so it can guarantee

> any alignment or other constraint. I do not have a preference here, so

> if you would prefer this approach I can change the patch.


I decided to use my definition which uses the macros '__spins' and '__elision', 
since they are already being used in architecture that support lock elision.
My view is with current constraint and architecture duplication of definitions
it simplifies a bit the mutex definition. I think in the future, if
architecture internal definition code differentiate more (such as for
pthread_rwlock_t definition) we can move them to the new arch specific
headers.

>>> +/* Common definition of pthread_cond_t. */

>>> +

>>> +struct __pthread_cond_s

>>> +{ 

>>> +  __extension__ union

>>> +  {

>>> +    __extension__ unsigned long long int __wseq;

>>> +    struct

>>> +    {

>>> +      unsigned int __low;

>>> +      unsigned int __high;

>>> +    } __wseq32;

>>> +  };

>>> +  __extension__ union

>>> +  {

>>> +    __extension__ unsigned long long int __g1_start;

>>> +    struct

>>> +    {

>>> +      unsigned int __low;

>>> +      unsigned int __high;

>>> +    } __g1_start32;

>>> +  };

>>> +  unsigned int __g_refs[2] __PTHREAD_LOCK_ALIGNMENT;

>>

>> If __PTHREAD_LOCK_ALIGNMENT is not just for locks, but more generally

>> captures alignment requirements for futex words, I think it should be

>> named differently, and there should be a comment somewhere explaining

>> it's use.  This is probably also the case for the other macros that this

>> file uses (though perhaps the __SIZEOF_PTHREAD_* macros are

>> self-explainatory).  A stub pthreadtypes-arch.h may be a way to do it,

>> though I'm not sure this works as well in this case as it works in the

>> case of futex-internal.h.

> 

> I think we can use pthreadtypes-arch.h, the idea is exactly to grab all

> the arch specific constraint and it should be an installed header.

> Otherwise we will need to create another installed header to have this

> definition and I am not sure if this is worth.

> 

> In any way, I will change the macro name to __LOCK_ALIGNMENT and I will

> add comments on sysdeps/nptl/bits/thread-shared-types.h explaining the

> requires defines the arch-specific header should have (__LOCK_ALIGNMENT,

> __PTHREAD_COMPAT_PADDING_MID, __PTHREAD_COMPAT_PADDING_END, and

> __PTHREAD_MUTEX_LOCK_ELISION).


I have added two new macros, __LOCK_ALIGNMENT and __ONCE_ALIGNMENT, to
grasp this idea and replicate their usage in the patch.

---

This patch removes all the replicated pthread definition accross the
architectures and consolidates it on shared headers.  The new
organization is as follow:

  * Architecture specific definition (such as pthread types sizes) are
    place in the new pthreadtypes-arch.h header in arch specific path.

  * All shared structure definition are moved to a common NPTL header
    at sysdeps/nptl/bits/pthreadtypes.h (with now includes the arch
    specific one for internal definitions).

  * Also, for C11 future thread support, both mutex and condition
    definition are placed in a common header at
    sysdeps/nptl/bits/thread-shared-types.h.

It is also a refactor patch without expected functional changes.
Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,
m68k-linux-gnu, microblaze-linux-gnu, mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).

	* posix/Makefile (headers): Add pthreadtypes-arch.h and
	thread-shared-types.h.
	* sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h: New file: arch
	specific thread definition.
	* sysdeps/alpha/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/arm/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/hppa/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/ia64/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/m68k/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/mips/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/nios2/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/s390/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/sh/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/sparc/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/tile/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/x86/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/nptl/bits/thread-shared-types.h: New file: shared
	thread definition between POSIX and C11.
	* sysdeps/aarch64/nptl/bits/pthreadtypes.h.: Remove file.
	* sysdeps/alpha/nptl/bits/pthreadtypes.h: Likewise.
	* sysdeps/arm/nptl/bits/pthreadtypes.h: Likewise.
	* sysdeps/hppa/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/ia64/nptl/bits/pthreadtypes.h: Likewise.
	* sysdeps/powerpc/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/x86/nptl/bits/pthreadtypes.h: Likewise.
	* sysdeps/nptl/bits/pthreadtypes.h: New file: common thread
	definitions shared across all architectures.
---
 ChangeLog                                        |  40 ++++
 posix/Makefile                                   |   1 +
 sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h    |  69 ++++++
 sysdeps/aarch64/nptl/bits/pthreadtypes.h         | 203 -----------------
 sysdeps/alpha/nptl/bits/pthreadtypes-arch.h      |  59 +++++
 sysdeps/alpha/nptl/bits/pthreadtypes.h           | 188 ----------------
 sysdeps/arm/nptl/bits/pthreadtypes-arch.h        |  69 ++++++
 sysdeps/arm/nptl/bits/pthreadtypes.h             | 202 -----------------
 sysdeps/hppa/nptl/bits/pthreadtypes-arch.h       |  89 ++++++++
 sysdeps/hppa/nptl/bits/pthreadtypes.h            | 230 -------------------
 sysdeps/ia64/nptl/bits/pthreadtypes-arch.h       |  61 +++++
 sysdeps/m68k/nptl/bits/pthreadtypes-arch.h       |  61 +++++
 sysdeps/m68k/nptl/bits/pthreadtypes.h            | 194 ----------------
 sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h |  70 ++++++
 sysdeps/microblaze/nptl/bits/pthreadtypes.h      | 194 ----------------
 sysdeps/mips/nptl/bits/pthreadtypes-arch.h       |  87 ++++++++
 sysdeps/mips/nptl/bits/pthreadtypes.h            | 250 ---------------------
 sysdeps/nios2/nptl/bits/pthreadtypes-arch.h      |  70 ++++++
 sysdeps/nios2/nptl/bits/pthreadtypes.h           | 202 -----------------
 sysdeps/{ia64 => }/nptl/bits/pthreadtypes.h      | 147 ++++--------
 sysdeps/nptl/bits/thread-shared-types.h          | 156 +++++++++++++
 sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h    |  79 +++++++
 sysdeps/powerpc/nptl/bits/pthreadtypes.h         | 249 ---------------------
 sysdeps/s390/nptl/bits/pthreadtypes-arch.h       |  81 +++++++
 sysdeps/s390/nptl/bits/pthreadtypes.h            | 261 ----------------------
 sysdeps/sh/nptl/bits/pthreadtypes-arch.h         |  69 ++++++
 sysdeps/sh/nptl/bits/pthreadtypes.h              | 202 -----------------
 sysdeps/sparc/nptl/bits/pthreadtypes-arch.h      |  79 +++++++
 sysdeps/sparc/nptl/bits/pthreadtypes.h           | 241 --------------------
 sysdeps/tile/nptl/bits/pthreadtypes-arch.h       |  79 +++++++
 sysdeps/tile/nptl/bits/pthreadtypes.h            | 241 --------------------
 sysdeps/x86/nptl/bits/pthreadtypes-arch.h        |  99 +++++++++
 sysdeps/x86/nptl/bits/pthreadtypes.h             | 271 -----------------------
 33 files changed, 1357 insertions(+), 3236 deletions(-)
 create mode 100644 sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/aarch64/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/alpha/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/arm/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/arm/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/hppa/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
 create mode 100644 sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/m68k/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/microblaze/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/mips/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/mips/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/nios2/nptl/bits/pthreadtypes.h
 rename sysdeps/{ia64 => }/nptl/bits/pthreadtypes.h (50%)
 create mode 100644 sysdeps/nptl/bits/thread-shared-types.h
 create mode 100644 sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/powerpc/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/s390/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/s390/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/sh/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/sh/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/sparc/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/tile/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/tile/nptl/bits/pthreadtypes.h
 create mode 100644 sysdeps/x86/nptl/bits/pthreadtypes-arch.h
 delete mode 100644 sysdeps/x86/nptl/bits/pthreadtypes.h

-- 
2.7.4diff --git a/posix/Makefile b/posix/Makefile
index 0fc509c..fe722cb 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -26,6 +26,7 @@ headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	      \
 	   glob.h regex.h wordexp.h fnmatch.h 				      \
 	   getopt.h bits/getopt_core.h bits/getopt_ext.h bits/getopt_posix.h  \
 	   bits/types.h bits/typesizes.h bits/pthreadtypes.h		      \
+	   bits/pthreadtypes-arch.h bits/thread-shared-types.h		      \
 	   bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h		      \
 	   bits/local_lim.h tar.h bits/utsname.h bits/confname.h	      \
 	   bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h	      \
diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..d13a75d
--- /dev/null
+++ b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,69 @@
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.h>
+
+#ifdef __ILP32__
+# define __SIZEOF_PTHREAD_ATTR_T        32
+# define __SIZEOF_PTHREAD_MUTEX_T       32
+# define __SIZEOF_PTHREAD_MUTEXATTR_T    4
+# define __SIZEOF_PTHREAD_CONDATTR_T     4
+# define __SIZEOF_PTHREAD_RWLOCK_T      48
+# define __SIZEOF_PTHREAD_BARRIER_T     20
+# define __SIZEOF_PTHREAD_BARRIERATTR_T  4
+#else
+# define __SIZEOF_PTHREAD_ATTR_T        64
+# define __SIZEOF_PTHREAD_MUTEX_T       48
+# define __SIZEOF_PTHREAD_MUTEXATTR_T    8
+# define __SIZEOF_PTHREAD_CONDATTR_T     8
+# define __SIZEOF_PTHREAD_RWLOCK_T      56
+# define __SIZEOF_PTHREAD_BARRIER_T     32
+# define __SIZEOF_PTHREAD_BARRIERATTR_T  8
+#endif
+#define __SIZEOF_PTHREAD_COND_T         48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T	8
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION	0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 97d9407..0000000
--- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.h>
-
-#ifdef __ILP32__
-# 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_COND_COMPAT_T 48
-# define __SIZEOF_PTHREAD_CONDATTR_T     4
-# define __SIZEOF_PTHREAD_RWLOCK_T      48
-# define __SIZEOF_PTHREAD_RWLOCKATTR_T   8
-# define __SIZEOF_PTHREAD_BARRIER_T     20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T  4
-#else
-# 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
-# define __SIZEOF_PTHREAD_RWLOCKATTR_T   8
-# define __SIZEOF_PTHREAD_BARRIER_T     32
-# define __SIZEOF_PTHREAD_BARRIERATTR_T  8
-#endif
-
-#define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    unsigned int __flags;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..b6f6cb1
--- /dev/null
+++ b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,59 @@
+/* Machine-specific pthread type layouts.  Alpha version.
+   Copyright (C) 2003-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#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
+#define __SIZEOF_PTHREAD_BARRIER_T	32
+#define __SIZEOF_PTHREAD_BARRIERATTR_T	4
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/alpha/nptl/bits/pthreadtypes.h b/sysdeps/alpha/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 1beaf10..0000000
--- a/sysdeps/alpha/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Machine-specific pthread type layouts.  Alpha version.
-   Copyright (C) 2003-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#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
-#define __SIZEOF_PTHREAD_BARRIER_T	32
-#define __SIZEOF_PTHREAD_BARRIERATTR_T	4
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..8333acb
--- /dev/null
+++ b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,69 @@
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.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
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+#endif
+  int __cur_writer;
+} __data;
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/arm/nptl/bits/pthreadtypes.h b/sysdeps/arm/nptl/bits/pthreadtypes.h
deleted file mode 100644
index dae7bc4..0000000
--- a/sysdeps/arm/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  long int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#endif
-    int __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..131e30e
--- /dev/null
+++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,89 @@
+/* Copyright (C) 2005-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+/* Linuxthread type sizes (bytes):
+   sizeof(pthread_attr_t) = 0x24 (36)
+   sizeof(pthread_barrier_t) = 0x30 (48)
+   sizeof(pthread_barrierattr_t) = 0x4 (4)
+   sizeof(pthread_cond_t) = 0x30 (48)
+   sizeof(pthread_condattr_t) = 0x4 (4)
+   sizeof(pthread_mutex_t) = 0x30 (48)
+   sizeof(pthread_mutexattr_t) = 0x4 (4)
+   sizeof(pthread_rwlock_t) = 0x40 (64)
+   sizeof(pthread_rwlockattr_t) = 0x8 (8)
+   sizeof(pthread_spinlock_t) = 0x10 (16) */
+
+#define __SIZEOF_PTHREAD_ATTR_T 36
+#define __SIZEOF_PTHREAD_MUTEX_T 48
+#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_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 64
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+
+/* The old 4-word 16-byte aligned lock. This is initalized
+   to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
+   Unused in NPTL.  */
+#define __PTHREAD_COMPAT_PADDING_MID  int __compat_padding[4]
+/* Two more words are left before the NPTL
+   pthread_mutex_t is larger than Linuxthreads.  */
+#define __PTHREAD_COMPAT_PADDING_END  int __reserved[2]
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  /* In the old Linuxthreads pthread_rwlock_t, this is the
+     start of the 4-word 16-byte aligned lock structure. The
+     next four words are all set to 1 by the Linuxthreads
+     PTHREAD_RWLOCK_INITIALIZER. We ignore them in NPTL.  */
+  int __compat_padding[4] __attribute__ ((__aligned__(16)));
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  int __cur_writer;
+  /* An unused word, reserved for future use. It was added
+     to maintain the location of the flags from the Linuxthreads
+     layout of this structure.  */
+  int __reserved1;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __pad2;
+  unsigned char __pad1;
+  unsigned char __shared;
+  unsigned char __flags;
+  /* The NPTL pthread_rwlock_t is 4 words smaller than the
+     Linuxthreads version. One word is in the middle of the
+     structure, the other three are at the end.  */
+  int __reserved2;
+  int __reserved3;
+  int __reserved4;
+} __data;
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h
deleted file mode 100644
index e37111a..0000000
--- a/sysdeps/hppa/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/* Copyright (C) 2005-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-/* Linuxthread type sizes (bytes):
-   sizeof(pthread_attr_t) = 0x24 (36)
-   sizeof(pthread_barrier_t) = 0x30 (48)
-   sizeof(pthread_barrierattr_t) = 0x4 (4)
-   sizeof(pthread_cond_t) = 0x30 (48)
-   sizeof(pthread_condattr_t) = 0x4 (4)
-   sizeof(pthread_mutex_t) = 0x30 (48)
-   sizeof(pthread_mutexattr_t) = 0x4 (4)
-   sizeof(pthread_rwlock_t) = 0x40 (64)
-   sizeof(pthread_rwlockattr_t) = 0x8 (8)
-   sizeof(pthread_spinlock_t) = 0x10 (16) */
-
-#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
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 __attribute__ ((__aligned__(16)));
-    unsigned int __count;
-    int __owner;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose. However, this structure
-   is exposed via PTHREAD_COND_INITIALIZER, and because of this, the
-   Linuxthreads version sets the first four ints to one. In the NPTL
-   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
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  long int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    /* In the old Linuxthreads pthread_rwlock_t, this is the
-       start of the 4-word 16-byte aligned lock structure. The
-       next four words are all set to 1 by the Linuxthreads
-       PTHREAD_RWLOCK_INITIALIZER. We ignore them in NPTL.  */
-    int __compat_padding[4] __attribute__ ((__aligned__(16)));
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    /* An unused word, reserved for future use. It was added
-       to maintain the location of the flags from the Linuxthreads
-       layout of this structure.  */
-    int __reserved1;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __pad2;
-    unsigned char __pad1;
-    unsigned char __shared;
-    unsigned char __flags;
-    /* The NPTL pthread_rwlock_t is 4 words smaller than the
-       Linuxthreads version. One word is in the middle of the
-       structure, the other three are at the end.  */
-    int __reserved2;
-    int __reserved3;
-    int __reserved4;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..631cb33
--- /dev/null
+++ b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,61 @@
+/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#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
+#define __SIZEOF_PTHREAD_BARRIER_T 32
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+/* Data structure for reader-write lock variable handling.  The
+   structure of the attribute type is not exposed on purpose.  */
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..845b9e6
--- /dev/null
+++ b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,61 @@
+/* Copyright (C) 2010-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
+
+   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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.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
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT __attribute__ ((__aligned__ (4)))
+#define __ONCE_ALIGNMENT __attribute__ ((__aligned__ (4)))
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers  __attribute__ ((__aligned__ (4)));
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes.h b/sysdeps/m68k/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 9a16bbf..0000000
--- a/sysdeps/m68k/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/* Copyright (C) 2010-2017 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
-
-   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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    /* Enforce proper alignment of fields used as futex words.  */
-    unsigned int __g_refs[2] __attribute__ ((__aligned__ (4)));
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int __attribute__ ((__aligned__ (4))) pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers  __attribute__ ((__aligned__ (4)));
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    int __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align __attribute__ ((__aligned__ (4)));
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..d687e2c
--- /dev/null
+++ b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,70 @@
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+# define _BITS_PTHREADTYPES_ARCH_H	1
+
+# include <endian.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
+# define __SIZEOF_PTHREAD_BARRIER_T      20
+# define __SIZEOF_PTHREAD_BARRIERATTR_T   4
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#  if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+#  else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+#  endif
+  int __cur_writer;
+};
+
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h.  */
diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes.h b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 7c5db6b..0000000
--- a/sysdeps/microblaze/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-# define _BITS_PTHREADTYPES_H	1
-
-# include <endian.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
-# define __SIZEOF_PTHREAD_RWLOCKATTR_T    8
-# define __SIZEOF_PTHREAD_BARRIER_T      20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T   4
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-
-# ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-/* Keys for thread-specific data.  */
-typedef unsigned int pthread_key_t;
-
-/* Once-only execution.  */
-typedef int pthread_once_t;
-
-# if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#  if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#  else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#  endif
-    int __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-# endif
-
-# ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-# endif
-
-#endif	/* bits/pthreadtypes.h.  */
diff --git a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..6aa1bda
--- /dev/null
+++ b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,87 @@
+/* Machine-specific pthread type layouts.  MIPS version.
+   Copyright (C) 2005-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.h>
+
+#if _MIPS_SIM == _ABI64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if _MIPS_SIM == _ABI64
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+# else
+# if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+# else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+# endif
+  int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/mips/nptl/bits/pthreadtypes.h b/sysdeps/mips/nptl/bits/pthreadtypes.h
deleted file mode 100644
index b1ebf4e..0000000
--- a/sysdeps/mips/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,250 +0,0 @@
-/* Machine-specific pthread type layouts.  MIPS version.
-   Copyright (C) 2005-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-typedef union pthread_attr_t pthread_attr_t;
-# define __have_pthread_attr_t	1
-#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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-# if _MIPS_SIM == _ABI64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#endif
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..e2732f9
--- /dev/null
+++ b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,70 @@
+/* Machine-specific pthread type layouts.  Nios II version.
+   Copyright (C) 2012-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.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
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+#endif
+  int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes.h b/sysdeps/nios2/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 8247013..0000000
--- a/sysdeps/nios2/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Machine-specific pthread type layouts.  Nios II version.
-   Copyright (C) 2012-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-#define __PTHREAD_SPINS 0
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  long int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#endif
-    int __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/nptl/bits/pthreadtypes.h
similarity index 50%
rename from sysdeps/ia64/nptl/bits/pthreadtypes.h
rename to sysdeps/nptl/bits/pthreadtypes.h
index c67ee86..8839559 100644
--- a/sysdeps/ia64/nptl/bits/pthreadtypes.h
+++ b/sysdeps/nptl/bits/pthreadtypes.h
@@ -1,6 +1,6 @@
-/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
+/* Declaration of common pthread types for all architectures.
+   Copyright (C) 2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -16,108 +16,30 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#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
-#define __SIZEOF_PTHREAD_BARRIER_T 32
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#ifndef _BITS_PTHREADTYPES_COMMON_H
+# define _BITS_PTHREADTYPES_COMMON_H	1
 
+/* For internal mutex and condition variable definitions.  */
+#include <bits/thread-shared-types.h>
 
 /* Thread identifiers.  The structure of the attribute type is not
    exposed on purpose.  */
 typedef unsigned long int pthread_t;
 
 
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-
-typedef union
-{
   char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
   int __align;
 } pthread_mutexattr_t;
 
 
-/* Data structure for conditional variable handling.  The structure of
+/* Data structure for condition variable handling.  The structure of
    the attribute type is not exposed on purpose.  */
 typedef union
 {
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
   char __size[__SIZEOF_PTHREAD_CONDATTR_T];
   int __align;
 } pthread_condattr_t;
@@ -128,36 +50,46 @@ typedef unsigned int pthread_key_t;
 
 
 /* Once-only execution */
-typedef int pthread_once_t;
+typedef int __ONCE_ALIGNMENT pthread_once_t;
+
+
+union pthread_attr_t
+{
+  char __size[__SIZEOF_PTHREAD_ATTR_T];
+  long int __align;
+};
+#ifndef __have_pthread_attr_t
+typedef union pthread_attr_t pthread_attr_t;
+# define __have_pthread_attr_t1
+#endif
+
+
+typedef union
+{
+  struct __pthread_mutex_s __data;
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];
+  long int __align;
+} pthread_mutex_t;
+
+
+typedef union
+{
+  struct __pthread_cond_s __data;
+  char __size[__SIZEOF_PTHREAD_COND_T];
+  __extension__ long long int __align;
+} pthread_cond_t;
 
 
 #if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
+/* Data structure for reader-writer lock variable handling.  The
+   structure of the attribute type is deliberately not exposed.  */
 typedef union
 {
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
+  struct __pthread_rwlock_arch_t __data;
   char __size[__SIZEOF_PTHREAD_RWLOCK_T];
   long int __align;
 } pthread_rwlock_t;
 
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
 typedef union
 {
   char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
@@ -186,5 +118,4 @@ typedef union
 } pthread_barrierattr_t;
 #endif
 
-
-#endif	/* bits/pthreadtypes.h */
+#endif
diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..ea8747a
--- /dev/null
+++ b/sysdeps/nptl/bits/thread-shared-types.h
@@ -0,0 +1,156 @@
+/* Common threading primitives definitions for both POSIX and C11.
+   Copyright (C) 2017 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/>.  */
+
+#ifndef _THREAD_SHARED_TYPES_H
+#define _THREAD_SHARED_TYPES_H 1
+
+/* Arch-specific definitions.  Each architecture must define the following
+   macros to define the expected sizes of pthread data types:
+
+   __SIZEOF_PTHREAD_ATTR_T        - size of pthread_attr_t.
+   __SIZEOF_PTHREAD_MUTEX_T       - size of pthread_mutex_t.
+   __SIZEOF_PTHREAD_MUTEXATTR_T   - size of pthread_mutexattr_t.
+   __SIZEOF_PTHREAD_COND_T        - size of pthread_cond_t.
+   __SIZEOF_PTHREAD_CONDATTR_T    - size of pthread_condattr_t.
+   __SIZEOF_PTHREAD_RWLOCK_T      - size of pthread_rwlock_t.
+   __SIZEOF_PTHREAD_RWLOCKATTR_T  - size of pthread_rwlockattr_t.
+   __SIZEOF_PTHREAD_BARRIER_T     - size of pthread_barrier_t.
+   __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t.
+
+   Also, the following macros must be define for internal pthread_mutex_t
+   struct definitions (struct __pthread_mutex_s):
+
+   __PTHREAD_COMPAT_PADDING_MID   - any additional members after 'kind'
+				    and before '__spin' (for 64 bits) or
+				    '__nusers' (for 32 bits).
+   __PTHREAD_COMPAT_PADDING_END   - any additional members at the end of
+				    the internal structure.
+   __PTHREAD_MUTEX_LOCK_ELISION   - 1 if the architecture supports lock
+				    elision or 0 otherwise.
+
+   The additional macro defines any constraint for the lock alignment
+   inside the thread structures:
+
+   __LOCK_ALIGNMENT - for internal lock/futex usage.
+
+   Same idea but for the once locking primitive:
+
+   __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition.
+
+   And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t)
+   must be defined.
+ */
+#include <bits/pthreadtypes-arch.h>
+
+/* Common definition of pthread_mutex_t. */
+
+#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
+
+/* Lock elision support.  */
+#if __PTHREAD_MUTEX_LOCK_ELISION
+# if __WORDSIZE == 64
+#  define __PTHREAD_SPINS_DATA	\
+  short __spins;		\
+  short __elision;
+#  define __PTHREAD_SPINS             0, 0
+# else
+#  define __PTHREAD_SPINS_DATA	\
+  struct			\
+  {				\
+    short __espins;		\
+    short __eelision;		\
+  } __elision_data
+#  define __PTHREAD_SPINS         { 0, 0 }
+#  define __spins __elision_data.__espins
+#  define __elision __elision_data.__eelision
+# endif
+#else
+# define __PTHREAD_SPINS_DATA int __spins
+/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
+# define __PTHREAD_SPINS 0
+#endif
+
+struct __pthread_mutex_s
+{ 
+  int __lock __LOCK_ALIGNMENT;
+  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 with static initializers.  */
+  int __kind;
+  __PTHREAD_COMPAT_PADDING_MID;
+#if __WORDSIZE == 64
+  __PTHREAD_SPINS_DATA;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV      1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    __PTHREAD_SPINS_DATA;
+    __pthread_slist_t __list;
+  }
+#endif
+  __PTHREAD_COMPAT_PADDING_END;
+};
+
+
+/* Common definition of pthread_cond_t. */
+
+struct __pthread_cond_s
+{ 
+  __extension__ union
+  {
+    __extension__ unsigned long long int __wseq;
+    struct
+    {
+      unsigned int __low;
+      unsigned int __high;
+    } __wseq32;
+  };
+  __extension__ union
+  {
+    __extension__ unsigned long long int __g1_start;
+    struct
+    {
+      unsigned int __low;
+      unsigned int __high;
+    } __g1_start32;
+  };
+  unsigned int __g_refs[2] __LOCK_ALIGNMENT;
+  unsigned int __g_size[2];
+  unsigned int __g1_orig_size;
+  unsigned int __wrefs;
+  unsigned int __g_signals[2];
+};
+
+#endif /* _THREAD_SHARED_TYPES_H  */
diff --git a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..f29119b
--- /dev/null
+++ b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,79 @@
+/* Machine-specific pthread type layouts.  PowerPC version.
+   Copyright (C) 2003-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    1
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __WORDSIZE == 64
+  int __cur_writer;
+  int __shared;
+  unsigned char __rwelision;
+  unsigned char __pad1[7];
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 }
+#else
+  unsigned char __rwelision;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  int __cur_writer;
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+#endif
+};
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/powerpc/nptl/bits/pthreadtypes.h b/sysdeps/powerpc/nptl/bits/pthreadtypes.h
deleted file mode 100644
index e5cda79..0000000
--- a/sysdeps/powerpc/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/* Machine-specific pthread type layouts.  PowerPC version.
-   Copyright (C) 2003-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-# if __WORDSIZE == 64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned char __rwelision;
-    unsigned char __pad1[7];
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 }
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    unsigned char __rwelision;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    int __cur_writer;
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..3a9ac57
--- /dev/null
+++ b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,81 @@
+/* Copyright (C) 2003-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#ifdef ENABLE_LOCK_ELISION
+#define __PTHREAD_MUTEX_LOCK_ELISION    1
+#else
+#define __PTHREAD_MUTEX_LOCK_ELISION	0
+#endif
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __WORDSIZE == 64
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+# else
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/s390/nptl/bits/pthreadtypes.h b/sysdeps/s390/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 48ffdb4..0000000
--- a/sysdeps/s390/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/* Copyright (C) 2003-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-# if __WORDSIZE == 64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..b2615fe
--- /dev/null
+++ b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,69 @@
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.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
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+#endif
+  unsigned long int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/sh/nptl/bits/pthreadtypes.h b/sysdeps/sh/nptl/bits/pthreadtypes.h
deleted file mode 100644
index eec5811..0000000
--- a/sysdeps/sh/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  long int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#endif
-    pthread_t __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..1e188cf
--- /dev/null
+++ b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,79 @@
+/* Machine-specific pthread type layouts.  SPARC version.
+   Copyright (C) 2003-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __WORDSIZE == 64
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+#else
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes.h b/sysdeps/sparc/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 525988c..0000000
--- a/sysdeps/sparc/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/* Machine-specific pthread type layouts.  SPARC version.
-   Copyright (C) 2003-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-# if __WORDSIZE == 64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..145ee42
--- /dev/null
+++ b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,79 @@
+/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Based on work contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __WORDSIZE == 64
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+  int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/sysdeps/tile/nptl/bits/pthreadtypes.h b/sysdeps/tile/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 1632d82..0000000
--- a/sysdeps/tile/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on work contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-
-   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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-#define __PTHREAD_SPINS 0
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-# if __WORDSIZE == 64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif /* bits/pthreadtypes.h */
diff --git a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..fd86806
--- /dev/null
+++ b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,99 @@
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#ifdef __x86_64__
+# if __WORDSIZE == 64
+#  define __SIZEOF_PTHREAD_MUTEX_T 40
+#  define __SIZEOF_PTHREAD_ATTR_T 56
+#  define __SIZEOF_PTHREAD_MUTEX_T 40
+#  define __SIZEOF_PTHREAD_RWLOCK_T 56
+#  define __SIZEOF_PTHREAD_BARRIER_T 32
+# else
+#  define __SIZEOF_PTHREAD_MUTEX_T 32
+#  define __SIZEOF_PTHREAD_ATTR_T 32
+#  define __SIZEOF_PTHREAD_MUTEX_T 32
+#  define __SIZEOF_PTHREAD_RWLOCK_T 44
+#  define __SIZEOF_PTHREAD_BARRIER_T 20
+# endif
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    1
+
+#define __LOCK_ALIGNMENT
+#define __ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#ifdef __x86_64__
+  int __cur_writer;
+  int __shared;
+  signed char __rwelision;
+# ifdef  __ILP32__
+  unsigned char __pad1[3];
+#  define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 }
+# else
+  unsigned char __pad1[7];
+#  define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 }
+# endif
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED	1
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  signed char __rwelision;
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+  unsigned char __pad2;
+  int __cur_writer;
+#endif
+};
+
+#ifndef __x86_64__
+/* Extra attributes for the cleanup functions.  */
+# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
+#endif
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/x86/nptl/bits/pthreadtypes.h b/sysdeps/x86/nptl/bits/pthreadtypes.h
deleted file mode 100644
index c3055ca..0000000
--- a/sysdeps/x86/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,271 +0,0 @@
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-#  define __SIZEOF_PTHREAD_BARRIER_T 32
-#  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
-#  define __SIZEOF_PTHREAD_BARRIER_T 20
-#  define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-typedef union pthread_attr_t pthread_attr_t;
-# define __have_pthread_attr_t	1
-#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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-# ifdef __x86_64__
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    signed char __rwelision;
-#  ifdef  __ILP32__
-    unsigned char __pad1[3];
-#    define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 }
-#  else
-    unsigned char __pad1[7];
-#    define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 }
-#  endif
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED	1
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    signed char __rwelision;
-# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-    unsigned char __pad2;
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#ifndef __x86_64__
-/* Extra attributes for the cleanup functions.  */
-# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
-#endif
-
-#endif	/* bits/pthreadtypes.h */

H.J. Lu Oct. 15, 2017, 1:52 p.m. UTC | #5
On Tue, May 09, 2017 at 12:10:28PM -0300, Adhemerval Zanella wrote:
> On 18/04/2017 10:08, Adhemerval Zanella wrote:

> > Thanks for the review.

> > 

> > On 18/04/2017 08:32, Torvald Riegel wrote:

> >> On Mon, 2017-04-03 at 12:08 -0300, Adhemerval Zanella wrote:

> >>> This patch removes all the replicated pthread definition accross the

> >>> architectures and consolidates it on shared headers.  The new

> >>> organization is as follow:

> >>>

> >>>   * Architecture specific definition (such as pthread types sizes) are

> >>>     place in the new pthreadtypes-arch.h header in arch specific path.

> >>>

> >>>   * All shared structure definition are moved to a common NPTL header

> >>>     at sysdeps/nptl/bits/pthreadtypes.h (with now includes the arch

> >>>     specific one for internal definitions).

> >>>

> >>>   * Also, for C11 future thread support, both mutex and conditional

> >>>     definition are placed in a common header at

> >>>     sysdeps/nptl/bits/thread-shared-types.h.

> >>>

> >>> It is also a refactor patch without expected functional changes.

> >>> Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,

> >>> arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,

> >>> m68k-linux-gnu, microblaze-linux-gnu, mips{64}-linux-gnu, nios2-linux-gnu,

> >>> powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,

> >>> tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).

> >>

> >> OK with the changes below.

> >>

> 

> This is the patch I intend to push, I just finishing up the build on multiple

> architecture to grab any missing issue.  I fixed the wording you pointed out

> in previous review.

> 

> > 

> > For this consolidation I replicated current architecture code that uses

> > lock elision (they differ only in the internal struct's name and all use

> > the macro for accessing the fields).

> > 

> > Another option would to move the elision field definition at each

> > architecture specific header (pthreadtypes-arch.h), so it can guarantee

> > any alignment or other constraint. I do not have a preference here, so

> > if you would prefer this approach I can change the patch.

> 

> I decided to use my definition which uses the macros '__spins' and '__elision', 

> since they are already being used in architecture that support lock elision.

> My view is with current constraint and architecture duplication of definitions

> it simplifies a bit the mutex definition. I think in the future, if

> architecture internal definition code differentiate more (such as for

> pthread_rwlock_t definition) we can move them to the new arch specific

> headers.

> 

> >>> +/* Common definition of pthread_cond_t. */

> >>> +

> >>> +struct __pthread_cond_s

> >>> +{ 

> >>> +  __extension__ union

> >>> +  {

> >>> +    __extension__ unsigned long long int __wseq;

> >>> +    struct

> >>> +    {

> >>> +      unsigned int __low;

> >>> +      unsigned int __high;

> >>> +    } __wseq32;

> >>> +  };

> >>> +  __extension__ union

> >>> +  {

> >>> +    __extension__ unsigned long long int __g1_start;

> >>> +    struct

> >>> +    {

> >>> +      unsigned int __low;

> >>> +      unsigned int __high;

> >>> +    } __g1_start32;

> >>> +  };

> >>> +  unsigned int __g_refs[2] __PTHREAD_LOCK_ALIGNMENT;

> >>

> >> If __PTHREAD_LOCK_ALIGNMENT is not just for locks, but more generally

> >> captures alignment requirements for futex words, I think it should be

> >> named differently, and there should be a comment somewhere explaining

> >> it's use.  This is probably also the case for the other macros that this

> >> file uses (though perhaps the __SIZEOF_PTHREAD_* macros are

> >> self-explainatory).  A stub pthreadtypes-arch.h may be a way to do it,

> >> though I'm not sure this works as well in this case as it works in the

> >> case of futex-internal.h.

> > 

> > I think we can use pthreadtypes-arch.h, the idea is exactly to grab all

> > the arch specific constraint and it should be an installed header.

> > Otherwise we will need to create another installed header to have this

> > definition and I am not sure if this is worth.

> > 

> > In any way, I will change the macro name to __LOCK_ALIGNMENT and I will

> > add comments on sysdeps/nptl/bits/thread-shared-types.h explaining the

> > requires defines the arch-specific header should have (__LOCK_ALIGNMENT,

> > __PTHREAD_COMPAT_PADDING_MID, __PTHREAD_COMPAT_PADDING_END, and

> > __PTHREAD_MUTEX_LOCK_ELISION).

> 

> I have added two new macros, __LOCK_ALIGNMENT and __ONCE_ALIGNMENT, to

> grasp this idea and replicate their usage in the patch.

> 

> ---

> 

> This patch removes all the replicated pthread definition accross the

> architectures and consolidates it on shared headers.  The new

> organization is as follow:

> 

>   * Architecture specific definition (such as pthread types sizes) are

>     place in the new pthreadtypes-arch.h header in arch specific path.

> 

>   * All shared structure definition are moved to a common NPTL header

>     at sysdeps/nptl/bits/pthreadtypes.h (with now includes the arch

>     specific one for internal definitions).

> 

>   * Also, for C11 future thread support, both mutex and condition

>     definition are placed in a common header at

>     sysdeps/nptl/bits/thread-shared-types.h.

> 

> It is also a refactor patch without expected functional changes.

> Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,

> arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,

> m68k-linux-gnu, microblaze-linux-gnu, mips{64}-linux-gnu, nios2-linux-gnu,

> powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,

> tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).

> 

> 	* posix/Makefile (headers): Add pthreadtypes-arch.h and

> 	thread-shared-types.h.

> 	* sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h: New file: arch

> 	specific thread definition.

> 	* sysdeps/alpha/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/arm/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/hppa/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/ia64/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/m68k/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/mips/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/nios2/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/s390/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/sh/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/sparc/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/tile/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/x86/nptl/bits/pthreadtypes-arch.h: Likewise.

> 	* sysdeps/nptl/bits/thread-shared-types.h: New file: shared

> 	thread definition between POSIX and C11.

> 	* sysdeps/aarch64/nptl/bits/pthreadtypes.h.: Remove file.

> 	* sysdeps/alpha/nptl/bits/pthreadtypes.h: Likewise.

> 	* sysdeps/arm/nptl/bits/pthreadtypes.h: Likewise.

> 	* sysdeps/hppa/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/ia64/nptl/bits/pthreadtypes.h: Likewise.

> 	* sysdeps/powerpc/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/x86/nptl/bits/pthreadtypes.h: Likewise.

> 	* sysdeps/nptl/bits/pthreadtypes.h: New file: common thread

> 	definitions shared across all architectures.

...
> diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h

> new file mode 100644

> index 0000000..ea8747a

> --- /dev/null

> +++ b/sysdeps/nptl/bits/thread-shared-types.h

> @@ -0,0 +1,156 @@

> +/* Common threading primitives definitions for both POSIX and C11.

> +   Copyright (C) 2017 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/>.  */

> +

> +#ifndef _THREAD_SHARED_TYPES_H

> +#define _THREAD_SHARED_TYPES_H 1

> +

> +/* Arch-specific definitions.  Each architecture must define the following

> +   macros to define the expected sizes of pthread data types:

> +

> +   __SIZEOF_PTHREAD_ATTR_T        - size of pthread_attr_t.

> +   __SIZEOF_PTHREAD_MUTEX_T       - size of pthread_mutex_t.

> +   __SIZEOF_PTHREAD_MUTEXATTR_T   - size of pthread_mutexattr_t.

> +   __SIZEOF_PTHREAD_COND_T        - size of pthread_cond_t.

> +   __SIZEOF_PTHREAD_CONDATTR_T    - size of pthread_condattr_t.

> +   __SIZEOF_PTHREAD_RWLOCK_T      - size of pthread_rwlock_t.

> +   __SIZEOF_PTHREAD_RWLOCKATTR_T  - size of pthread_rwlockattr_t.

> +   __SIZEOF_PTHREAD_BARRIER_T     - size of pthread_barrier_t.

> +   __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t.

> +

> +   Also, the following macros must be define for internal pthread_mutex_t

> +   struct definitions (struct __pthread_mutex_s):

> +

> +   __PTHREAD_COMPAT_PADDING_MID   - any additional members after 'kind'

> +				    and before '__spin' (for 64 bits) or

> +				    '__nusers' (for 32 bits).

> +   __PTHREAD_COMPAT_PADDING_END   - any additional members at the end of

> +				    the internal structure.

> +   __PTHREAD_MUTEX_LOCK_ELISION   - 1 if the architecture supports lock

> +				    elision or 0 otherwise.

> +

> +   The additional macro defines any constraint for the lock alignment

> +   inside the thread structures:

> +

> +   __LOCK_ALIGNMENT - for internal lock/futex usage.

> +

> +   Same idea but for the once locking primitive:

> +

> +   __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition.

> +

> +   And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t)

> +   must be defined.

> + */

> +#include <bits/pthreadtypes-arch.h>

> +

> +/* Common definition of pthread_mutex_t. */

> +

> +#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

> +

> +/* Lock elision support.  */

> +#if __PTHREAD_MUTEX_LOCK_ELISION

> +# if __WORDSIZE == 64

> +#  define __PTHREAD_SPINS_DATA	\

> +  short __spins;		\

> +  short __elision;

> +#  define __PTHREAD_SPINS             0, 0

> +# else

> +#  define __PTHREAD_SPINS_DATA	\

> +  struct			\

> +  {				\

> +    short __espins;		\

> +    short __eelision;		\

> +  } __elision_data

> +#  define __PTHREAD_SPINS         { 0, 0 }

> +#  define __spins __elision_data.__espins

> +#  define __elision __elision_data.__eelision

> +# endif

> +#else

> +# define __PTHREAD_SPINS_DATA int __spins

> +/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */

> +# define __PTHREAD_SPINS 0

> +#endif

> +

> +struct __pthread_mutex_s

> +{ 

> +  int __lock __LOCK_ALIGNMENT;

> +  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 with static initializers.  */

> +  int __kind;

> +  __PTHREAD_COMPAT_PADDING_MID;

> +#if __WORDSIZE == 64

> +  __PTHREAD_SPINS_DATA;

> +  __pthread_list_t __list;

> +# define __PTHREAD_MUTEX_HAVE_PREV      1

> +#else

> +  unsigned int __nusers;

> +  __extension__ union

> +  {

> +    __PTHREAD_SPINS_DATA;

> +    __pthread_slist_t __list;

> +  }

> +#endif

> +  __PTHREAD_COMPAT_PADDING_END;

> +};

> +

> +

...
> diff --git a/sysdeps/x86/nptl/bits/pthreadtypes.h b/sysdeps/x86/nptl/bits/pthreadtypes.h

> deleted file mode 100644

> index c3055ca..0000000

> --- a/sysdeps/x86/nptl/bits/pthreadtypes.h

> +++ /dev/null

> @@ -1,271 +0,0 @@

> -/* Copyright (C) 2002-2017 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/>.  */

> -

> -#ifndef _BITS_PTHREADTYPES_H

> -#define _BITS_PTHREADTYPES_H	1

> -

> -#include <bits/wordsize.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

> -#  define __SIZEOF_PTHREAD_BARRIER_T 32

> -#  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

> -#  define __SIZEOF_PTHREAD_BARRIER_T 20

> -#  define __SIZEOF_PTHREAD_BARRIERATTR_T 4

> -# 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

> -# define __SIZEOF_PTHREAD_BARRIER_T 20

> -# define __SIZEOF_PTHREAD_BARRIERATTR_T 4

> -#endif

> -

> -

> -/* Thread identifiers.  The structure of the attribute type is not

> -   exposed on purpose.  */

> -typedef unsigned long int pthread_t;

> -

> -

> -union pthread_attr_t

> -{

> -  char __size[__SIZEOF_PTHREAD_ATTR_T];

> -  long int __align;

> -};

> -#ifndef __have_pthread_attr_t

> -typedef union pthread_attr_t pthread_attr_t;

> -# define __have_pthread_attr_t	1

> -#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 with static initializers.  */

> -    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

> -{

> -  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];

> -  int __align;

> -} pthread_mutexattr_t;

> -

> -

> -/* Data structure for conditional variable handling.  The structure of

> -   the attribute type is not exposed on purpose.  */

> -typedef union

> -{

> -  struct

> -  {

> -    __extension__ union

> -    {

> -      __extension__ unsigned long long int __wseq;

> -      struct {

> -	unsigned int __low;

> -	unsigned int __high;

> -      } __wseq32;

> -    };

> -    __extension__ union

> -    {

> -      __extension__ unsigned long long int __g1_start;

> -      struct {

> -	unsigned int __low;

> -	unsigned int __high;

> -      } __g1_start32;

> -    };

> -    unsigned int __g_refs[2];

> -    unsigned int __g_size[2];

> -    unsigned int __g1_orig_size;

> -    unsigned int __wrefs;

> -    unsigned int __g_signals[2];

> -  } __data;

> -  char __size[__SIZEOF_PTHREAD_COND_T];

> -  __extension__ long long int __align;

> -} pthread_cond_t;

> -

> -typedef union

> -{

> -  char __size[__SIZEOF_PTHREAD_CONDATTR_T];

> -  int __align;

> -} pthread_condattr_t;

> -

> -

> -/* Keys for thread-specific data */

> -typedef unsigned int pthread_key_t;

> -

> -

> -/* Once-only execution */

> -typedef int pthread_once_t;

> -

> -

> -#if defined __USE_UNIX98 || defined __USE_XOPEN2K

> -/* Data structure for read-write lock variable handling.  The

> -   structure of the attribute type is not exposed on purpose.  */

> -typedef union

> -{

> -# ifdef __x86_64__

> -  struct

> -  {

> -    unsigned int __readers;

> -    unsigned int __writers;

> -    unsigned int __wrphase_futex;

> -    unsigned int __writers_futex;

> -    unsigned int __pad3;

> -    unsigned int __pad4;

> -    int __cur_writer;

> -    int __shared;

> -    signed char __rwelision;

> -#  ifdef  __ILP32__

> -    unsigned char __pad1[3];

> -#    define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 }

> -#  else

> -    unsigned char __pad1[7];

> -#    define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 }

> -#  endif

> -    unsigned long int __pad2;

> -    /* FLAGS must stay at this position in the structure to maintain

> -       binary compatibility.  */

> -    unsigned int __flags;

> -# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED	1

> -  } __data;

> -# else

> -  struct

> -  {

> -    unsigned int __readers;

> -    unsigned int __writers;

> -    unsigned int __wrphase_futex;

> -    unsigned int __writers_futex;

> -    unsigned int __pad3;

> -    unsigned int __pad4;

> -    /* FLAGS must stay at this position in the structure to maintain

> -       binary compatibility.  */

> -    unsigned char __flags;

> -    unsigned char __shared;

> -    signed char __rwelision;

> -# define __PTHREAD_RWLOCK_ELISION_EXTRA 0

> -    unsigned char __pad2;

> -    int __cur_writer;

> -  } __data;

> -# endif

> -  char __size[__SIZEOF_PTHREAD_RWLOCK_T];

> -  long int __align;

> -} pthread_rwlock_t;

> -

> -typedef union

> -{

> -  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];

> -  long int __align;

> -} pthread_rwlockattr_t;

> -#endif

> -

> -

> -#ifdef __USE_XOPEN2K

> -/* POSIX spinlock data type.  */

> -typedef volatile int pthread_spinlock_t;

> -

> -

> -/* POSIX barriers data type.  The structure of the type is

> -   deliberately not exposed.  */

> -typedef union

> -{

> -  char __size[__SIZEOF_PTHREAD_BARRIER_T];

> -  long int __align;

> -} pthread_barrier_t;

> -

> -typedef union

> -{

> -  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];

> -  int __align;

> -} pthread_barrierattr_t;

> -#endif

> -

> -

> -#ifndef __x86_64__

> -/* Extra attributes for the cleanup functions.  */

> -# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))

> -#endif

> -

> -#endif	/* bits/pthreadtypes.h */

> -- 


This changed __PTHREAD_MUTEX_HAVE_PREV for x32.


H.J.
diff mbox series

Patch

diff --git a/posix/Makefile b/posix/Makefile
index ae17646..fc2aecc 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -25,6 +25,7 @@  include ../Makeconfig
 headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	      \
 	   glob.h regex.h wordexp.h fnmatch.h getopt.h			      \
 	   bits/types.h bits/typesizes.h bits/pthreadtypes.h		      \
+	   bits/pthreadtypes-arch.h bits/thread-shared-types.h		      \
 	   bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h		      \
 	   bits/local_lim.h tar.h bits/utsname.h bits/confname.h	      \
 	   bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h	      \
diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..0a81fe7
--- /dev/null
+++ b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,70 @@ 
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.h>
+
+#ifdef __ILP32__
+# define __SIZEOF_PTHREAD_ATTR_T        32
+# define __SIZEOF_PTHREAD_MUTEX_T       32
+# define __SIZEOF_PTHREAD_MUTEXATTR_T    4
+# define __SIZEOF_PTHREAD_CONDATTR_T     4
+# define __SIZEOF_PTHREAD_RWLOCK_T      48
+# define __SIZEOF_PTHREAD_BARRIER_T     20
+# define __SIZEOF_PTHREAD_BARRIERATTR_T  4
+#else
+# define __SIZEOF_PTHREAD_ATTR_T        64
+# define __SIZEOF_PTHREAD_MUTEX_T       48
+# define __SIZEOF_PTHREAD_MUTEXATTR_T    8
+# define __SIZEOF_PTHREAD_CONDATTR_T     8
+# define __SIZEOF_PTHREAD_RWLOCK_T      56
+# define __SIZEOF_PTHREAD_BARRIER_T     32
+# define __SIZEOF_PTHREAD_BARRIERATTR_T  8
+#endif
+#define __SIZEOF_PTHREAD_COND_COMPAT_T	48
+#define __SIZEOF_PTHREAD_COND_T         48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T	8
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION	0
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 97d9407..0000000
--- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,203 +0,0 @@ 
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.h>
-
-#ifdef __ILP32__
-# 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_COND_COMPAT_T 48
-# define __SIZEOF_PTHREAD_CONDATTR_T     4
-# define __SIZEOF_PTHREAD_RWLOCK_T      48
-# define __SIZEOF_PTHREAD_RWLOCKATTR_T   8
-# define __SIZEOF_PTHREAD_BARRIER_T     20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T  4
-#else
-# 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
-# define __SIZEOF_PTHREAD_RWLOCKATTR_T   8
-# define __SIZEOF_PTHREAD_BARRIER_T     32
-# define __SIZEOF_PTHREAD_BARRIERATTR_T  8
-#endif
-
-#define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    unsigned int __flags;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..f5c6ebe
--- /dev/null
+++ b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,59 @@ 
+/* Machine-specific pthread type layouts.  Alpha version.
+   Copyright (C) 2003-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#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
+#define __SIZEOF_PTHREAD_BARRIER_T	32
+#define __SIZEOF_PTHREAD_BARRIERATTR_T	4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/alpha/nptl/bits/pthreadtypes.h b/sysdeps/alpha/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 1beaf10..0000000
--- a/sysdeps/alpha/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,188 +0,0 @@ 
-/* Machine-specific pthread type layouts.  Alpha version.
-   Copyright (C) 2003-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#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
-#define __SIZEOF_PTHREAD_BARRIER_T	32
-#define __SIZEOF_PTHREAD_BARRIERATTR_T	4
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..2e11ad7
--- /dev/null
+++ b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,70 @@ 
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.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
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+#endif
+  int __cur_writer;
+} __data;
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/arm/nptl/bits/pthreadtypes.h b/sysdeps/arm/nptl/bits/pthreadtypes.h
deleted file mode 100644
index dae7bc4..0000000
--- a/sysdeps/arm/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,202 +0,0 @@ 
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  long int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#endif
-    int __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..75c32d1
--- /dev/null
+++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,90 @@ 
+/* Copyright (C) 2005-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+/* Linuxthread type sizes (bytes):
+   sizeof(pthread_attr_t) = 0x24 (36)
+   sizeof(pthread_barrier_t) = 0x30 (48)
+   sizeof(pthread_barrierattr_t) = 0x4 (4)
+   sizeof(pthread_cond_t) = 0x30 (48)
+   sizeof(pthread_condattr_t) = 0x4 (4)
+   sizeof(pthread_mutex_t) = 0x30 (48)
+   sizeof(pthread_mutexattr_t) = 0x4 (4)
+   sizeof(pthread_rwlock_t) = 0x40 (64)
+   sizeof(pthread_rwlockattr_t) = 0x8 (8)
+   sizeof(pthread_spinlock_t) = 0x10 (16) */
+
+#define __SIZEOF_PTHREAD_ATTR_T 36
+#define __SIZEOF_PTHREAD_MUTEX_T 48
+#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_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCK_T 64
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_LOCK_ALIGNMENT __attribute__ ((__aligned__(16)))
+/* The old 4-word 16-byte aligned lock. This is initalized
+   to all ones by the Linuxthreads PTHREAD_MUTEX_INITIALIZER.
+   Unused in NPTL.  */
+#define __PTHREAD_COMPAT_PADDING_MID  int __compat_padding[4]
+/* Two more words are left before the NPTL
+   pthread_mutex_t is larger than Linuxthreads.  */
+#define __PTHREAD_COMPAT_PADDING_END  int __reserved[2]
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  /* In the old Linuxthreads pthread_rwlock_t, this is the
+     start of the 4-word 16-byte aligned lock structure. The
+     next four words are all set to 1 by the Linuxthreads
+     PTHREAD_RWLOCK_INITIALIZER. We ignore them in NPTL.  */
+  int __compat_padding[4] __attribute__ ((__aligned__(16)));
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  int __cur_writer;
+  /* An unused word, reserved for future use. It was added
+     to maintain the location of the flags from the Linuxthreads
+     layout of this structure.  */
+  int __reserved1;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __pad2;
+  unsigned char __pad1;
+  unsigned char __shared;
+  unsigned char __flags;
+  /* The NPTL pthread_rwlock_t is 4 words smaller than the
+     Linuxthreads version. One word is in the middle of the
+     structure, the other three are at the end.  */
+  int __reserved2;
+  int __reserved3;
+  int __reserved4;
+} __data;
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes.h b/sysdeps/hppa/nptl/bits/pthreadtypes.h
deleted file mode 100644
index e37111a..0000000
--- a/sysdeps/hppa/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,230 +0,0 @@ 
-/* Copyright (C) 2005-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-/* Linuxthread type sizes (bytes):
-   sizeof(pthread_attr_t) = 0x24 (36)
-   sizeof(pthread_barrier_t) = 0x30 (48)
-   sizeof(pthread_barrierattr_t) = 0x4 (4)
-   sizeof(pthread_cond_t) = 0x30 (48)
-   sizeof(pthread_condattr_t) = 0x4 (4)
-   sizeof(pthread_mutex_t) = 0x30 (48)
-   sizeof(pthread_mutexattr_t) = 0x4 (4)
-   sizeof(pthread_rwlock_t) = 0x40 (64)
-   sizeof(pthread_rwlockattr_t) = 0x8 (8)
-   sizeof(pthread_spinlock_t) = 0x10 (16) */
-
-#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
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 __attribute__ ((__aligned__(16)));
-    unsigned int __count;
-    int __owner;
-    /* KIND must stay at this position in the structure to maintain
-       binary compatibility with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose. However, this structure
-   is exposed via PTHREAD_COND_INITIALIZER, and because of this, the
-   Linuxthreads version sets the first four ints to one. In the NPTL
-   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
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  long int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    /* In the old Linuxthreads pthread_rwlock_t, this is the
-       start of the 4-word 16-byte aligned lock structure. The
-       next four words are all set to 1 by the Linuxthreads
-       PTHREAD_RWLOCK_INITIALIZER. We ignore them in NPTL.  */
-    int __compat_padding[4] __attribute__ ((__aligned__(16)));
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    /* An unused word, reserved for future use. It was added
-       to maintain the location of the flags from the Linuxthreads
-       layout of this structure.  */
-    int __reserved1;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __pad2;
-    unsigned char __pad1;
-    unsigned char __shared;
-    unsigned char __flags;
-    /* The NPTL pthread_rwlock_t is 4 words smaller than the
-       Linuxthreads version. One word is in the middle of the
-       structure, the other three are at the end.  */
-    int __reserved2;
-    int __reserved3;
-    int __reserved4;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..7cc7549
--- /dev/null
+++ b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,61 @@ 
+/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#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
+#define __SIZEOF_PTHREAD_BARRIER_T 32
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+/* Data structure for read-write lock variable handling.  The
+   structure of the attribute type is not exposed on purpose.  */
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..0c1636a
--- /dev/null
+++ b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,61 @@ 
+/* Copyright (C) 2010-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
+
+   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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.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
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT __attribute__ ((__aligned__ (4)))
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_LOCK_ALIGNMENT  __attribute__ ((__aligned__ (4)))
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers  __attribute__ ((__aligned__ (4)));
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes.h b/sysdeps/m68k/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 9a16bbf..0000000
--- a/sysdeps/m68k/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,194 +0,0 @@ 
-/* Copyright (C) 2010-2017 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
-
-   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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    /* Enforce proper alignment of fields used as futex words.  */
-    unsigned int __g_refs[2] __attribute__ ((__aligned__ (4)));
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int __attribute__ ((__aligned__ (4))) pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers  __attribute__ ((__aligned__ (4)));
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    int __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align __attribute__ ((__aligned__ (4)));
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..f8788fc
--- /dev/null
+++ b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,71 @@ 
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+# define _BITS_PTHREADTYPES_ARCH_H	1
+
+# include <endian.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
+# define __SIZEOF_PTHREAD_RWLOCKATTR_T    8
+# define __SIZEOF_PTHREAD_BARRIER_T      20
+# define __SIZEOF_PTHREAD_BARRIERATTR_T   4
+
+# define __PTHREAD_ONCE_ALIGNMENT
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#  if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+#  else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+#  endif
+  int __cur_writer;
+};
+
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h.  */
diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes.h b/sysdeps/microblaze/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 7c5db6b..0000000
--- a/sysdeps/microblaze/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,194 +0,0 @@ 
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-# define _BITS_PTHREADTYPES_H	1
-
-# include <endian.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
-# define __SIZEOF_PTHREAD_RWLOCKATTR_T    8
-# define __SIZEOF_PTHREAD_BARRIER_T      20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T   4
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-
-# ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-/* Keys for thread-specific data.  */
-typedef unsigned int pthread_key_t;
-
-/* Once-only execution.  */
-typedef int pthread_once_t;
-
-# if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#  if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#  else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#  endif
-    int __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-# endif
-
-# ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-# endif
-
-#endif	/* bits/pthreadtypes.h.  */
diff --git a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..4ce33c8
--- /dev/null
+++ b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,87 @@ 
+/* Machine-specific pthread type layouts.  MIPS version.
+   Copyright (C) 2005-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.h>
+
+#if _MIPS_SIM == _ABI64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if _MIPS_SIM == _ABI64
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+# else
+# if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+# else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+# endif
+  int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/mips/nptl/bits/pthreadtypes.h b/sysdeps/mips/nptl/bits/pthreadtypes.h
deleted file mode 100644
index b1ebf4e..0000000
--- a/sysdeps/mips/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,250 +0,0 @@ 
-/* Machine-specific pthread type layouts.  MIPS version.
-   Copyright (C) 2005-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-typedef union pthread_attr_t pthread_attr_t;
-# define __have_pthread_attr_t	1
-#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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-# if _MIPS_SIM == _ABI64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#endif
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..577cfc2
--- /dev/null
+++ b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,70 @@ 
+/* Machine-specific pthread type layouts.  Nios II version.
+   Copyright (C) 2012-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.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
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+#endif
+  int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes.h b/sysdeps/nios2/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 8247013..0000000
--- a/sysdeps/nios2/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,202 +0,0 @@ 
-/* Machine-specific pthread type layouts.  Nios II version.
-   Copyright (C) 2012-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-#define __PTHREAD_SPINS 0
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  long int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#endif
-    int __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/nptl/bits/pthreadtypes.h
similarity index 53%
rename from sysdeps/ia64/nptl/bits/pthreadtypes.h
rename to sysdeps/nptl/bits/pthreadtypes.h
index c67ee86..6348cf5 100644
--- a/sysdeps/ia64/nptl/bits/pthreadtypes.h
+++ b/sysdeps/nptl/bits/pthreadtypes.h
@@ -1,6 +1,6 @@ 
-/* Copyright (C) 2003-2017 Free Software Foundation, Inc.
+/* Declaration of common pthread types for all architectures.
+   Copyright (C) 2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -16,69 +16,21 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#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
-#define __SIZEOF_PTHREAD_BARRIER_T 32
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#ifndef _BITS_PTHREADTYPES_COMMON_H
+# define _BITS_PTHREADTYPES_COMMON_H	1
 
+/* For internal mutex and conditional definitions.  */
+#include <bits/thread-shared-types.h>
 
 /* Thread identifiers.  The structure of the attribute type is not
    exposed on purpose.  */
 typedef unsigned long int pthread_t;
 
 
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-
-typedef union
-{
   char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
   int __align;
 } pthread_mutexattr_t;
@@ -88,36 +40,6 @@  typedef union
    the attribute type is not exposed on purpose.  */
 typedef union
 {
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
   char __size[__SIZEOF_PTHREAD_CONDATTR_T];
   int __align;
 } pthread_condattr_t;
@@ -131,33 +53,43 @@  typedef unsigned int pthread_key_t;
 typedef int pthread_once_t;
 
 
+union pthread_attr_t
+{
+  char __size[__SIZEOF_PTHREAD_ATTR_T];
+  long int __align;
+};
+#ifndef __have_pthread_attr_t
+typedef union pthread_attr_t pthread_attr_t;
+# define __have_pthread_attr_t1
+#endif
+
+
+typedef union
+{
+  struct __pthread_mutex_s __data;
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];
+  long int __align;
+} pthread_mutex_t;
+
+
+typedef union
+{
+  struct __pthread_cond_s __data;
+  char __size[__SIZEOF_PTHREAD_COND_T];
+  __extension__ long long int __align;
+} pthread_cond_t;
+
+
 #if defined __USE_UNIX98 || defined __USE_XOPEN2K
 /* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
+   structure of the attribute type is deliberately not exposed.  */
 typedef union
 {
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
+  struct __pthread_rwlock_arch_t __data;
   char __size[__SIZEOF_PTHREAD_RWLOCK_T];
   long int __align;
 } pthread_rwlock_t;
 
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
 typedef union
 {
   char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
@@ -186,5 +118,4 @@  typedef union
 } pthread_barrierattr_t;
 #endif
 
-
-#endif	/* bits/pthreadtypes.h */
+#endif
diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
new file mode 100644
index 0000000..82085f1
--- /dev/null
+++ b/sysdeps/nptl/bits/thread-shared-types.h
@@ -0,0 +1,121 @@ 
+/* Common thread definition for both POSIX and C11.
+   Copyright (C) 2017 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/>.  */
+
+#ifndef _THREAD_SHARED_TYPES_H
+#define _THREAD_SHARED_TYPES_H 1
+
+/* Arch-specific definitions.  */
+#include <bits/pthreadtypes-arch.h>
+
+/* Common definition of pthread_mutex_t. */
+
+#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
+
+/* Lock elision support.  */
+#if __PTHREAD_MUTEX_LOCK_ELISION
+# if __WORDSIZE == 64
+#  define __PTHREAD_SPINS_DATA	\
+  short __spins;		\
+  short __elision;
+#  define __PTHREAD_SPINS             0, 0
+# else
+#  define __PTHREAD_SPINS_DATA	\
+  struct			\
+  {				\
+    short __espins;		\
+    short __eelision;		\
+  } __elision_data
+#  define __PTHREAD_SPINS         { 0, 0 }
+#  define __spins __elision_data.__espins
+#  define __elision __elision_data.__eelision
+# endif
+#else
+# define __PTHREAD_SPINS_DATA int __spins
+/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
+# define __PTHREAD_SPINS 0
+#endif
+
+struct __pthread_mutex_s
+{ 
+  int __lock __PTHREAD_LOCK_ALIGNMENT;
+  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 with static initializers.  */
+  int __kind;
+  __PTHREAD_COMPAT_PADDING_MID;
+#if __WORDSIZE == 64
+  __PTHREAD_SPINS_DATA;
+  __pthread_list_t __list;
+# define __PTHREAD_MUTEX_HAVE_PREV      1
+#else
+  unsigned int __nusers;
+  __extension__ union
+  {
+    __PTHREAD_SPINS_DATA;
+    __pthread_slist_t __list;
+  }
+#endif
+  __PTHREAD_COMPAT_PADDING_END;
+};
+
+
+/* Common definition of pthread_cond_t. */
+
+struct __pthread_cond_s
+{ 
+  __extension__ union
+  {
+    __extension__ unsigned long long int __wseq;
+    struct
+    {
+      unsigned int __low;
+      unsigned int __high;
+    } __wseq32;
+  };
+  __extension__ union
+  {
+    __extension__ unsigned long long int __g1_start;
+    struct
+    {
+      unsigned int __low;
+      unsigned int __high;
+    } __g1_start32;
+  };
+  unsigned int __g_refs[2] __PTHREAD_LOCK_ALIGNMENT;
+  unsigned int __g_size[2];
+  unsigned int __g1_orig_size;
+  unsigned int __wrefs;
+  unsigned int __g_signals[2];
+};
+
+#endif /* _THREAD_SHARED_TYPES_H  */
diff --git a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..6d22e38
--- /dev/null
+++ b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,79 @@ 
+/* Machine-specific pthread type layouts.  PowerPC version.
+   Copyright (C) 2003-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    1
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __WORDSIZE == 64
+  int __cur_writer;
+  int __shared;
+  unsigned char __rwelision;
+  unsigned char __pad1[7];
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 }
+#else
+  unsigned char __rwelision;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  int __cur_writer;
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+#endif
+};
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/powerpc/nptl/bits/pthreadtypes.h b/sysdeps/powerpc/nptl/bits/pthreadtypes.h
deleted file mode 100644
index e5cda79..0000000
--- a/sysdeps/powerpc/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,249 +0,0 @@ 
-/* Machine-specific pthread type layouts.  PowerPC version.
-   Copyright (C) 2003-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-# if __WORDSIZE == 64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned char __rwelision;
-    unsigned char __pad1[7];
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 }
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    unsigned char __rwelision;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    int __cur_writer;
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..b45f859
--- /dev/null
+++ b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,81 @@ 
+/* Copyright (C) 2003-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#ifdef ENABLE_LOCK_ELISION
+#define __PTHREAD_MUTEX_LOCK_ELISION    1
+#else
+#define __PTHREAD_MUTEX_LOCK_ELISION	0
+#endif
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __WORDSIZE == 64
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+# else
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/s390/nptl/bits/pthreadtypes.h b/sysdeps/s390/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 48ffdb4..0000000
--- a/sysdeps/s390/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,261 +0,0 @@ 
-/* Copyright (C) 2003-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-# if __WORDSIZE == 64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..889844a
--- /dev/null
+++ b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,70 @@ 
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <endian.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
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIER_T 20
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __BYTE_ORDER == __BIG_ENDIAN
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+#endif
+  unsigned long int __cur_writer;
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/sh/nptl/bits/pthreadtypes.h b/sysdeps/sh/nptl/bits/pthreadtypes.h
deleted file mode 100644
index eec5811..0000000
--- a/sysdeps/sh/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,202 +0,0 @@ 
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <endian.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
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  long int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  long int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-#else
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-#endif
-    pthread_t __cur_writer;
-  } __data;
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..63075cf
--- /dev/null
+++ b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,79 @@ 
+/* Machine-specific pthread type layouts.  SPARC version.
+   Copyright (C) 2003-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_CONDATTR_T 4
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __WORDSIZE == 64
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+#else
+  unsigned char __pad1;
+  unsigned char __pad2;
+  unsigned char __shared;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes.h b/sysdeps/sparc/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 525988c..0000000
--- a/sysdeps/sparc/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,241 +0,0 @@ 
-/* Machine-specific pthread type layouts.  SPARC version.
-   Copyright (C) 2003-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is
-   deliberately not exposed.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 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 with static initializers.  */
-    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
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is deliberately not exposed.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is deliberately not exposed.  */
-typedef union
-{
-# if __WORDSIZE == 64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    unsigned char __pad1;
-    unsigned char __pad2;
-    unsigned char __shared;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..c598207
--- /dev/null
+++ b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,79 @@ 
+/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Based on work contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
+
+   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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+/* Data structure for mutex handling. */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    0
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#if __WORDSIZE == 64
+  int __cur_writer;
+  int __shared;
+  unsigned long int __pad1;
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  unsigned char __pad1;
+  unsigned char __pad2;
+  int __cur_writer;
+#endif
+};
+
+#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+
+#endif /* bits/pthreadtypes.h */
diff --git a/sysdeps/tile/nptl/bits/pthreadtypes.h b/sysdeps/tile/nptl/bits/pthreadtypes.h
deleted file mode 100644
index 1632d82..0000000
--- a/sysdeps/tile/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,241 +0,0 @@ 
-/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on work contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-
-   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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.  */
-#define __PTHREAD_SPINS 0
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-# if __WORDSIZE == 64
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    unsigned long int __pad1;
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    unsigned char __pad1;
-    unsigned char __pad2;
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#endif /* bits/pthreadtypes.h */
diff --git a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
new file mode 100644
index 0000000..1857b2f
--- /dev/null
+++ b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
@@ -0,0 +1,99 @@ 
+/* Copyright (C) 2002-2017 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/>.  */
+
+#ifndef _BITS_PTHREADTYPES_ARCH_H
+#define _BITS_PTHREADTYPES_ARCH_H	1
+
+#include <bits/wordsize.h>
+
+#ifdef __x86_64__
+# if __WORDSIZE == 64
+#  define __SIZEOF_PTHREAD_MUTEX_T 40
+#  define __SIZEOF_PTHREAD_ATTR_T 56
+#  define __SIZEOF_PTHREAD_MUTEX_T 40
+#  define __SIZEOF_PTHREAD_RWLOCK_T 56
+#  define __SIZEOF_PTHREAD_BARRIER_T 32
+# else
+#  define __SIZEOF_PTHREAD_MUTEX_T 32
+#  define __SIZEOF_PTHREAD_ATTR_T 32
+#  define __SIZEOF_PTHREAD_MUTEX_T 32
+#  define __SIZEOF_PTHREAD_RWLOCK_T 44
+#  define __SIZEOF_PTHREAD_BARRIER_T 20
+# endif
+#else
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_ATTR_T 36
+# define __SIZEOF_PTHREAD_MUTEX_T 24
+# define __SIZEOF_PTHREAD_RWLOCK_T 32
+# define __SIZEOF_PTHREAD_BARRIER_T 20
+#endif
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#define __PTHREAD_ONCE_ALIGNMENT
+
+/* Definitions for internal mutex struct.  */
+#define __PTHREAD_LOCK_ALIGNMENT
+#define __PTHREAD_COMPAT_PADDING_MID
+#define __PTHREAD_COMPAT_PADDING_END
+#define __PTHREAD_MUTEX_LOCK_ELISION    1
+
+struct __pthread_rwlock_arch_t
+{
+  unsigned int __readers;
+  unsigned int __writers;
+  unsigned int __wrphase_futex;
+  unsigned int __writers_futex;
+  unsigned int __pad3;
+  unsigned int __pad4;
+#ifdef __x86_64__
+  int __cur_writer;
+  int __shared;
+  signed char __rwelision;
+# ifdef  __ILP32__
+  unsigned char __pad1[3];
+#  define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 }
+# else
+  unsigned char __pad1[7];
+#  define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 }
+# endif
+  unsigned long int __pad2;
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned int __flags;
+# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED	1
+#else
+  /* FLAGS must stay at this position in the structure to maintain
+     binary compatibility.  */
+  unsigned char __flags;
+  unsigned char __shared;
+  signed char __rwelision;
+# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
+  unsigned char __pad2;
+  int __cur_writer;
+#endif
+};
+
+#ifndef __x86_64__
+/* Extra attributes for the cleanup functions.  */
+# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
+#endif
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/sysdeps/x86/nptl/bits/pthreadtypes.h b/sysdeps/x86/nptl/bits/pthreadtypes.h
deleted file mode 100644
index c3055ca..0000000
--- a/sysdeps/x86/nptl/bits/pthreadtypes.h
+++ /dev/null
@@ -1,271 +0,0 @@ 
-/* Copyright (C) 2002-2017 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/>.  */
-
-#ifndef _BITS_PTHREADTYPES_H
-#define _BITS_PTHREADTYPES_H	1
-
-#include <bits/wordsize.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
-#  define __SIZEOF_PTHREAD_BARRIER_T 32
-#  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
-#  define __SIZEOF_PTHREAD_BARRIER_T 20
-#  define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-# 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
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#endif
-
-
-/* Thread identifiers.  The structure of the attribute type is not
-   exposed on purpose.  */
-typedef unsigned long int pthread_t;
-
-
-union pthread_attr_t
-{
-  char __size[__SIZEOF_PTHREAD_ATTR_T];
-  long int __align;
-};
-#ifndef __have_pthread_attr_t
-typedef union pthread_attr_t pthread_attr_t;
-# define __have_pthread_attr_t	1
-#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 with static initializers.  */
-    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
-{
-  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
-  int __align;
-} pthread_mutexattr_t;
-
-
-/* Data structure for conditional variable handling.  The structure of
-   the attribute type is not exposed on purpose.  */
-typedef union
-{
-  struct
-  {
-    __extension__ union
-    {
-      __extension__ unsigned long long int __wseq;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __wseq32;
-    };
-    __extension__ union
-    {
-      __extension__ unsigned long long int __g1_start;
-      struct {
-	unsigned int __low;
-	unsigned int __high;
-      } __g1_start32;
-    };
-    unsigned int __g_refs[2];
-    unsigned int __g_size[2];
-    unsigned int __g1_orig_size;
-    unsigned int __wrefs;
-    unsigned int __g_signals[2];
-  } __data;
-  char __size[__SIZEOF_PTHREAD_COND_T];
-  __extension__ long long int __align;
-} pthread_cond_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
-  int __align;
-} pthread_condattr_t;
-
-
-/* Keys for thread-specific data */
-typedef unsigned int pthread_key_t;
-
-
-/* Once-only execution */
-typedef int pthread_once_t;
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Data structure for read-write lock variable handling.  The
-   structure of the attribute type is not exposed on purpose.  */
-typedef union
-{
-# ifdef __x86_64__
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    int __cur_writer;
-    int __shared;
-    signed char __rwelision;
-#  ifdef  __ILP32__
-    unsigned char __pad1[3];
-#    define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0 }
-#  else
-    unsigned char __pad1[7];
-#    define __PTHREAD_RWLOCK_ELISION_EXTRA 0, { 0, 0, 0, 0, 0, 0, 0 }
-#  endif
-    unsigned long int __pad2;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned int __flags;
-# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED	1
-  } __data;
-# else
-  struct
-  {
-    unsigned int __readers;
-    unsigned int __writers;
-    unsigned int __wrphase_futex;
-    unsigned int __writers_futex;
-    unsigned int __pad3;
-    unsigned int __pad4;
-    /* FLAGS must stay at this position in the structure to maintain
-       binary compatibility.  */
-    unsigned char __flags;
-    unsigned char __shared;
-    signed char __rwelision;
-# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-    unsigned char __pad2;
-    int __cur_writer;
-  } __data;
-# endif
-  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
-  long int __align;
-} pthread_rwlock_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
-  long int __align;
-} pthread_rwlockattr_t;
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* POSIX spinlock data type.  */
-typedef volatile int pthread_spinlock_t;
-
-
-/* POSIX barriers data type.  The structure of the type is
-   deliberately not exposed.  */
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIER_T];
-  long int __align;
-} pthread_barrier_t;
-
-typedef union
-{
-  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
-  int __align;
-} pthread_barrierattr_t;
-#endif
-
-
-#ifndef __x86_64__
-/* Extra attributes for the cleanup functions.  */
-# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
-#endif
-
-#endif	/* bits/pthreadtypes.h */