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