diff mbox

[RFC,v2,18/27] New gen-as-const-header infinity-thread_self.h

Message ID 1465814311-31470-19-git-send-email-gbenson@redhat.com
State New
Headers show

Commit Message

Gary Benson June 13, 2016, 10:38 a.m. UTC
This commit adds a new generated assembler constants header
infinity-thread_self.h, and adds a rule to build it to
sysdeps/generic/Makefile.  sysdeps/$cpu/nptl/tls.h files are
expected to define macros that mirror those defined for
libthread_db.  infinity-thread_self.sym contains various
compile-time checks to ensure a consistent set of Infinity
macros is defined.
---
 sysdeps/generic/Makefile                 |    2 +
 sysdeps/generic/infinity-thread_self.sym |   64 ++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 sysdeps/generic/infinity-thread_self.sym
diff mbox

Patch

diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
index f68ac68..c6a4f57 100644
--- a/sysdeps/generic/Makefile
+++ b/sysdeps/generic/Makefile
@@ -26,3 +26,5 @@  sysdep_routines += framestate unwind-pe
 shared-only-routines += framestate unwind-pe
 endif
 endif
+
+gen-as-const-headers += infinity-thread_self.sym
diff --git a/sysdeps/generic/infinity-thread_self.sym b/sysdeps/generic/infinity-thread_self.sym
new file mode 100644
index 0000000..8e9f47f
--- /dev/null
+++ b/sysdeps/generic/infinity-thread_self.sym
@@ -0,0 +1,64 @@ 
+#include <tls.h>
+
+-- Each machine's tls.h should define I8_THREAD_SELF to one of these.
+#define I8_TS_CONST_THREAD_AREA         1
+#define I8_TS_REGISTER                  2
+#define I8_TS_REGISTER_THREAD_AREA      3
+
+#ifndef I8_THREAD_SELF
+# error "tls.h must #define I8_THREAD_SELF"
+#endif
+
+-- If tls.h defined DB_THREAD_SELF_INCLUDE then we need to include it.
+#ifdef DB_THREAD_SELF_INCLUDE
+# include DB_THREAD_SELF_INCLUDE
+#endif
+
+#if I8_THREAD_SELF == I8_TS_CONST_THREAD_AREA
+# ifndef I8_TS_CTA_VALUE
+#  error "I8_TS_CONST_THREAD_AREA machines must #define I8_TS_CTA_VALUE"
+# endif
+#else
+# define I8_TS_CTA_VALUE -1
+#endif
+
+#if I8_THREAD_SELF == I8_TS_REGISTER
+# ifndef I8_TS_REG_OFFSET
+#  error "I8_TS_REGISTER machines must #define I8_TS_REG_OFFSET"
+# endif
+# ifndef I8_TS_REG_BIAS
+#  error "I8_TS_REGISTER machines must #define I8_TS_REG_BIAS"
+# endif
+#else
+# define I8_TS_REG_OFFSET -1
+# define I8_TS_REG_BIAS -1
+#endif
+
+#if I8_THREAD_SELF == I8_TS_REGISTER_THREAD_AREA
+# ifndef I8_TS_RTA_OFFSET
+#  error "I8_TS_REGISTER_THREAD_AREA machines must #define I8_TS_RTA_OFFSET"
+# endif
+# ifndef I8_TS_RTA_SCALE
+#  error "I8_TS_REGISTER_THREAD_AREA machines must #define I8_TS_RTA_SCALE"
+# endif
+#else
+# define I8_TS_RTA_OFFSET -1
+# define I8_TS_RTA_SCALE -1
+#endif
+
+
+-- Constants to export
+
+I8_THREAD_SELF
+
+I8_TS_CONST_THREAD_AREA
+I8_TS_REGISTER
+I8_TS_REGISTER_THREAD_AREA
+
+I8_TS_CTA_VALUE
+
+I8_TS_REG_OFFSET
+I8_TS_REG_BIAS
+
+I8_TS_RTA_OFFSET
+I8_TS_RTA_SCALE