2004-12-01 Jakub Jelinek <jakub@redhat.com>
[glibc/history.git] / elf / tst-tlsmod2.c
blob98d9d3e5185c2e5a006fb58de7c80ed2076e1854
1 #include <stdio.h>
3 #include <tls.h>
5 #ifdef USE_TLS
6 #include "tls-macros.h"
9 COMMON_INT_DEF(foo);
12 int
13 in_dso (int n, int *caller_foop)
15 int *foop;
16 int result = 0;
18 puts ("foo"); /* Make sure PLT is used before macros. */
19 asm ("" ::: "memory");
21 foop = TLS_GD (foo);
23 if (caller_foop != NULL && foop != caller_foop)
25 printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop);
26 result = 1;
28 else if (*foop != n)
30 printf ("foo != %d\n", n);
31 result = 1;
34 *foop = 16;
36 return result;
38 #endif