about summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-15 07:23:41 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-15 07:26:01 -0700
commitdf44f9d02b68de45ba8c3984f47ecf1a523306ec (patch)
tree37530370279455989e5ec0e89ddfd37076820903
parentaca3e9b42f9c172af368f2fc54d2c7299b231cc0 (diff)
downloadglibc-df44f9d02b68de45ba8c3984f47ecf1a523306ec.tar.gz
glibc-df44f9d02b68de45ba8c3984f47ecf1a523306ec.tar.xz
glibc-df44f9d02b68de45ba8c3984f47ecf1a523306ec.zip
x32: Verify that NPTL structures are correct [BZ #22298]
Add a build-time check to verify that NPTL structures are correct.

	* sysdeps/x86_64/x32/nptl/Makefile: New file.
	* sysdeps/x86_64/x32/nptl/nptl-check.sym: Likewise.
-rw-r--r--sysdeps/x86_64/x32/nptl/Makefile4
-rw-r--r--sysdeps/x86_64/x32/nptl/nptl-check.sym9
2 files changed, 13 insertions, 0 deletions
diff --git a/sysdeps/x86_64/x32/nptl/Makefile b/sysdeps/x86_64/x32/nptl/Makefile
new file mode 100644
index 0000000000..e780beaf11
--- /dev/null
+++ b/sysdeps/x86_64/x32/nptl/Makefile
@@ -0,0 +1,4 @@
+ifeq ($(subdir),csu)
+# Verify that NPTL structures are correct.
+gen-as-const-headers += nptl-check.sym
+endif
diff --git a/sysdeps/x86_64/x32/nptl/nptl-check.sym b/sysdeps/x86_64/x32/nptl/nptl-check.sym
new file mode 100644
index 0000000000..8573250d61
--- /dev/null
+++ b/sysdeps/x86_64/x32/nptl/nptl-check.sym
@@ -0,0 +1,9 @@
+#include <sysdep.h>
+#include <pthread.h>
+
+PREV			offsetof (struct __pthread_internal_list, __prev)
+NEXT			offsetof (struct __pthread_internal_list, __next)
+
+#if __PTHREAD_MUTEX_HAVE_PREV != 1
+#error __PTHREAD_MUTEX_HAVE_PREV must be 1
+#endif