chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.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 }