lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #include <stdio.h> |
| 2 | |
| 3 | #include "tls-macros.h" |
| 4 | |
| 5 | extern int in_dso (int n, int *caller_foop); |
| 6 | |
| 7 | COMMON_INT_DEF(comm_n); |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | int |
| 13 | in_dso2 (void) |
| 14 | { |
| 15 | int *foop; |
| 16 | int result = 0; |
| 17 | static int n; |
| 18 | int *np; |
| 19 | |
| 20 | puts ("foo"); /* Make sure PLT is used before macros. */ |
| 21 | asm ("" ::: "memory"); |
| 22 | |
| 23 | foop = TLS_GD (foo); |
| 24 | np = TLS_GD (comm_n); |
| 25 | |
| 26 | if (n != *np) |
| 27 | { |
| 28 | printf ("n = %d != comm_n = %d\n", n, *np); |
| 29 | result = 1; |
| 30 | } |
| 31 | |
| 32 | result |= in_dso (*foop = 42 + n++, foop); |
| 33 | |
| 34 | *foop = 16; |
| 35 | |
| 36 | return result; |
| 37 | } |