blob: 4893cdae716b1959946dd197216335427d14252d [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#include <stdio.h>
2
3#include <tls.h>
4
5#ifdef USE_TLS
6# include "tls-macros.h"
7
8
9COMMON_INT_DEF(baz);
10
11
12int
13in_dso (int n, int *caller_bazp)
14{
15 int *bazp;
16 int result = 0;
17
18 puts ("foo"); /* Make sure PLT is used before macros. */
19 __asm__ ("" ::: "memory");
20
21 bazp = TLS_GD (baz);
22
23 if (caller_bazp != NULL && bazp != caller_bazp)
24 {
25 printf ("callers address of baz differs: %p vs %p\n", caller_bazp, bazp);
26 result = 1;
27 }
28 else if (*bazp != n)
29 {
30 printf ("baz != %d\n", n);
31 result = 1;
32 }
33
34 *bazp = 16;
35
36 return result;
37}
38#endif