about summary refs log tree commit diff
path: root/elf/tst-tlsmod2.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/tst-tlsmod2.c')
-rw-r--r--elf/tst-tlsmod2.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/elf/tst-tlsmod2.c b/elf/tst-tlsmod2.c
new file mode 100644
index 0000000000..30ed67163d
--- /dev/null
+++ b/elf/tst-tlsmod2.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+
+#include <tls.h>
+#include "tls-macros.h"
+
+#ifdef USE_TLS
+
+COMMON_INT_DEF(foo);
+
+
+int
+in_dso (int n, int *caller_foop)
+{
+  int *foop = TLS_GD (foo);
+  int result = 0;
+
+  if (caller_foop != NULL && foop != caller_foop)
+    {
+      printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop);
+      result = 1;
+    }
+  else if (*foop != n)
+    {
+      printf ("foo != %d\n", n);
+      result = 1;
+    }
+
+  *foop = 16;
+
+  return result;
+}
+#endif