summaryrefslogtreecommitdiff
path: root/src/tilegx/gen-offsets.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tilegx/gen-offsets.c')
-rw-r--r--src/tilegx/gen-offsets.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tilegx/gen-offsets.c b/src/tilegx/gen-offsets.c
new file mode 100644
index 00000000..8704bb21
--- /dev/null
+++ b/src/tilegx/gen-offsets.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stddef.h>
+#include <ucontext.h>
+
+#define UC(N,X) \
+ printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X))
+
+#define SC(N,X) \
+ printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X))
+
+int
+main (void)
+{
+ printf (
+"/* Linux-specific definitions: */\n\n"
+
+"/* Define various structure offsets to simplify cross-compilation. */\n\n"
+
+"/* Offsets for TILEGX Linux \"ucontext_t\": */\n\n");
+
+ UC ("FLAGS", uc_flags);
+ UC ("LINK", uc_link);
+ UC ("STACK", uc_stack);
+ UC ("MCONTEXT", uc_mcontext);
+ UC ("SIGMASK", uc_sigmask);
+
+ UC ("MCONTEXT_GREGS", uc_mcontext.gregs);
+
+ return 0;
+}