]> git.ipfire.org Git - thirdparty/glibc.git/blob - elf/tst-tlsmod2.c
.
[thirdparty/glibc.git] / elf / tst-tlsmod2.c
1 #include <stdio.h>
2
3 #include <tls.h>
4
5 #ifdef USE_TLS
6 #include "tls-macros.h"
7
8
9 COMMON_INT_DEF(foo);
10
11
12 int
13 in_dso (int n, int *caller_foop)
14 {
15 int *foop;
16 int result = 0;
17
18 puts ("foo"); /* Make sure PLT is used before macros. */
19 asm ("" ::: "memory");
20
21 foop = TLS_GD (foo);
22
23 if (caller_foop != NULL && foop != caller_foop)
24 {
25 printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop);
26 result = 1;
27 }
28 else if (*foop != n)
29 {
30 printf ("foo != %d\n", n);
31 result = 1;
32 }
33
34 *foop = 16;
35
36 return result;
37 }
38 #endif