This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] x32: Verify that NPTL structures are correct [BZ #22298]
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Sun, 15 Oct 2017 08:12:26 -0700
- Subject: [PATCH] x32: Verify that NPTL structures are correct [BZ #22298]
- Authentication-results: sourceware.org; auth=none
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