]>
Commit | Line | Data |
---|---|---|
aed283dd UD |
1 | #include <stdio.h> |
2 | ||
fc093be1 UD |
3 | #include "tls-macros.h" |
4 | ||
aed283dd UD |
5 | |
6 | COMMON_INT_DEF(foo); | |
7 | ||
8 | ||
9 | int | |
10 | in_dso (int n, int *caller_foop) | |
11 | { | |
e6f52680 | 12 | int *foop; |
aed283dd UD |
13 | int result = 0; |
14 | ||
e6f52680 | 15 | puts ("foo"); /* Make sure PLT is used before macros. */ |
046b4069 | 16 | asm ("" ::: "memory"); |
e6f52680 RM |
17 | |
18 | foop = TLS_GD (foo); | |
19 | ||
aed283dd UD |
20 | if (caller_foop != NULL && foop != caller_foop) |
21 | { | |
22 | printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop); | |
23 | result = 1; | |
24 | } | |
25 | else if (*foop != n) | |
26 | { | |
27 | printf ("foo != %d\n", n); | |
28 | result = 1; | |
29 | } | |
30 | ||
31 | *foop = 16; | |
32 | ||
33 | return result; | |
34 | } |