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

login
register
mail settings
Submitter Gary Benson
Date Oct. 20, 2015, 2:56 p.m.
Message ID <1445352975-17844-19-git-send-email-gbenson@redhat.com>
Download mbox | patch
Permalink /patch/9255/
State New
Headers show

Comments

Gary Benson - Oct. 20, 2015, 2:56 p.m.
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 |   74 ++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 0 deletions(-)
 create mode 100644 sysdeps/generic/infinity-thread_self.sym

Patch

diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
index ed269f3..b5132d6 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..de68048
--- /dev/null
+++ b/sysdeps/generic/infinity-thread_self.sym
@@ -0,0 +1,74 @@ 
+#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_SIZE
+#  error "I8_TS_REGISTER machines must #define I8_TS_REG_SIZE"
+# endif
+# 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_SIZE -1
+# 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_SIZE
+#  error "I8_TS_REGISTER_THREAD_AREA machines must #define I8_TS_RTA_SIZE"
+# endif
+# 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_SIZE -1
+# 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_SIZE
+I8_TS_REG_OFFSET
+I8_TS_REG_BIAS
+
+I8_TS_RTA_SIZE
+I8_TS_RTA_OFFSET
+I8_TS_RTA_SCALE