[PATCH] x32: Verify that NPTL structures are correct [BZ #22298]

H.J. Lu hjl.tools@gmail.com
Sun Oct 15 15:12:00 GMT 2017


Add a build-time check to verify that NPTL structures are correct.

OK for master and 2.25/2.26 branches after fix for [BZ #22298] is
applied?

H.J.
	[BZ #22298]
	* sysdeps/x86_64/x32/nptl/Makefile: New file.
	* sysdeps/x86_64/x32/nptl/nptl-check.sym: Likewise.
---
 sysdeps/x86_64/x32/nptl/Makefile       | 4 ++++
 sysdeps/x86_64/x32/nptl/nptl-check.sym | 9 +++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 sysdeps/x86_64/x32/nptl/Makefile
 create mode 100644 sysdeps/x86_64/x32/nptl/nptl-check.sym

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..c4b07b83bf
--- /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
-- 
2.13.5



More information about the Libc-alpha mailing list