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