diff --git a/nptl/Makefile b/nptl/Makefile
index d819349..7492b06 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -304,7 +304,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
 	tst-thread_local1 tst-mutex-errorcheck tst-robust10 \
 	tst-robust-fork tst-create-detached tst-memstream
 
-tests-internal := tst-typesizes \
+tests-internal := tst-typesizes tst-offsets \
 		  tst-rwlock19 tst-rwlock20 \
 		  tst-sem11 tst-sem12 tst-sem13 \
 		  tst-barrier5 tst-signal7 tst-mutex8 tst-mutex8-static \
diff --git a/nptl/tst-offsets.c b/nptl/tst-offsets.c
new file mode 100644
index 0000000..1aa8a0e
--- /dev/null
+++ b/nptl/tst-offsets.c
@@ -0,0 +1,41 @@
+/* Check pthread internal offsets.
+   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/>.  */
+
+#include <stdio.h>
+#include <pthreadP.h>
+#include <semaphore.h>
+
+#include <pthread-offsets.h>
+
+#define STR_HELPER(x) #x
+#define STR(x) STR_HELPER(x)
+
+static int
+do_test (void)
+{
+  /* Check if internal fields in pthread_mutex_t used by static initializers
+     have the expected offset.  */
+  _Static_assert (offsetof (pthread_mutex_t, __data.__kind) ==
+		  __PTHREAD_MUTEX_KIND_OFFSET,
+		  "offset of __kind field != "
+		  STR (__PTHREAD_MUTEX_KIND_OFFSET));
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/sysdeps/aarch64/nptl/pthread-offsets.h b/sysdeps/aarch64/nptl/pthread-offsets.h
new file mode 100644
index 0000000..aaca502
--- /dev/null
+++ b/sysdeps/aarch64/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  16
diff --git a/sysdeps/alpha/nptl/pthread-offsets.h b/sysdeps/alpha/nptl/pthread-offsets.h
new file mode 100644
index 0000000..aaca502
--- /dev/null
+++ b/sysdeps/alpha/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  16
diff --git a/sysdeps/arm/nptl/pthread-offsets.h b/sysdeps/arm/nptl/pthread-offsets.h
new file mode 100644
index 0000000..235677f
--- /dev/null
+++ b/sysdeps/arm/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  12
diff --git a/sysdeps/hppa/nptl/pthread-offsets.h b/sysdeps/hppa/nptl/pthread-offsets.h
new file mode 100644
index 0000000..235677f
--- /dev/null
+++ b/sysdeps/hppa/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  12
diff --git a/sysdeps/i386/nptl/pthread-offsets.h b/sysdeps/i386/nptl/pthread-offsets.h
new file mode 100644
index 0000000..235677f
--- /dev/null
+++ b/sysdeps/i386/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  12
diff --git a/sysdeps/ia64/nptl/pthread-offsets.h b/sysdeps/ia64/nptl/pthread-offsets.h
new file mode 100644
index 0000000..aaca502
--- /dev/null
+++ b/sysdeps/ia64/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  16
diff --git a/sysdeps/m68k/nptl/pthread-offsets.h b/sysdeps/m68k/nptl/pthread-offsets.h
new file mode 100644
index 0000000..235677f
--- /dev/null
+++ b/sysdeps/m68k/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  12
diff --git a/sysdeps/microblaze/nptl/pthread-offsets.h b/sysdeps/microblaze/nptl/pthread-offsets.h
new file mode 100644
index 0000000..235677f
--- /dev/null
+++ b/sysdeps/microblaze/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  12
diff --git a/sysdeps/mips/nptl/pthread-offsets.h b/sysdeps/mips/nptl/pthread-offsets.h
new file mode 100644
index 0000000..6dd3dea
--- /dev/null
+++ b/sysdeps/mips/nptl/pthread-offsets.h
@@ -0,0 +1,5 @@
+#if _MIPS_SIM == _ABI64
+# define __PTHREAD_MUTEX_KIND_OFFSET  16
+#else
+# define __PTHREAD_MUTEX_KIND_OFFSET  12
+#endif
diff --git a/sysdeps/nios2/nptl/pthread-offsets.h b/sysdeps/nios2/nptl/pthread-offsets.h
new file mode 100644
index 0000000..235677f
--- /dev/null
+++ b/sysdeps/nios2/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  12
diff --git a/sysdeps/powerpc/nptl/pthread-offsets.h b/sysdeps/powerpc/nptl/pthread-offsets.h
new file mode 100644
index 0000000..f88961b
--- /dev/null
+++ b/sysdeps/powerpc/nptl/pthread-offsets.h
@@ -0,0 +1,7 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_KIND_OFFSET  16
+#else
+# define __PTHREAD_MUTEX_KIND_OFFSET  12
+#endif
diff --git a/sysdeps/s390/nptl/pthread-offsets.h b/sysdeps/s390/nptl/pthread-offsets.h
new file mode 100644
index 0000000..f88961b
--- /dev/null
+++ b/sysdeps/s390/nptl/pthread-offsets.h
@@ -0,0 +1,7 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_KIND_OFFSET  16
+#else
+# define __PTHREAD_MUTEX_KIND_OFFSET  12
+#endif
diff --git a/sysdeps/sh/nptl/pthread-offsets.h b/sysdeps/sh/nptl/pthread-offsets.h
new file mode 100644
index 0000000..235677f
--- /dev/null
+++ b/sysdeps/sh/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  12
diff --git a/sysdeps/sparc/nptl/pthread-offsets.h b/sysdeps/sparc/nptl/pthread-offsets.h
new file mode 100644
index 0000000..f88961b
--- /dev/null
+++ b/sysdeps/sparc/nptl/pthread-offsets.h
@@ -0,0 +1,7 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_KIND_OFFSET  16
+#else
+# define __PTHREAD_MUTEX_KIND_OFFSET  12
+#endif
diff --git a/sysdeps/tile/nptl/pthread-offsets.h b/sysdeps/tile/nptl/pthread-offsets.h
new file mode 100644
index 0000000..f88961b
--- /dev/null
+++ b/sysdeps/tile/nptl/pthread-offsets.h
@@ -0,0 +1,7 @@
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_KIND_OFFSET  16
+#else
+# define __PTHREAD_MUTEX_KIND_OFFSET  12
+#endif
diff --git a/sysdeps/x86_64/nptl/pthread-offsets.h b/sysdeps/x86_64/nptl/pthread-offsets.h
new file mode 100644
index 0000000..aaca502
--- /dev/null
+++ b/sysdeps/x86_64/nptl/pthread-offsets.h
@@ -0,0 +1 @@
+#define __PTHREAD_MUTEX_KIND_OFFSET  16
