blob: 40eb1407f864f64aba34e5307fbd5426554aff61 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#include <stdio.h>
2
3#include "tls-macros.h"
4
5
6COMMON_INT_DEF(foo);
7
8
9int
10in_dso (int n, int *caller_foop)
11{
12 int *foop;
13 int result = 0;
14
15 puts ("foo"); /* Make sure PLT is used before macros. */
16 asm ("" ::: "memory");
17
18 foop = TLS_GD (foo);
19
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}