Fix ChangeLog formatting
[glibc.git] / elf / tst-tlsmod1.c
blob8d9156791be9eabfac5e5bfb7c97af3e360290d8
1 #include <stdio.h>
3 #include "tls-macros.h"
6 /* One define int variable, two externs. */
7 COMMON_INT_DEF(foo);
8 VAR_INT_DEF(bar);
9 VAR_INT_DECL(baz);
11 extern int in_dso (void);
13 int
14 in_dso (void)
16 int result = 0;
17 int *ap, *bp, *cp;
19 /* Get variables using initial exec model. */
20 fputs ("get sum of foo and bar (IE)", stdout);
21 asm ("" ::: "memory");
22 ap = TLS_IE (foo);
23 bp = TLS_IE (bar);
24 printf (" = %d\n", *ap + *bp);
25 result |= *ap + *bp != 3;
26 if (*ap != 1)
28 printf ("foo = %d\n", *ap);
29 result = 1;
31 if (*bp != 2)
33 printf ("bar = %d\n", *bp);
34 result = 1;
38 /* Get variables using generic dynamic model. */
39 fputs ("get sum of foo and bar and baz (GD)", stdout);
40 ap = TLS_GD (foo);
41 bp = TLS_GD (bar);
42 cp = TLS_GD (baz);
43 printf (" = %d\n", *ap + *bp + *cp);
44 result |= *ap + *bp + *cp != 6;
45 if (*ap != 1)
47 printf ("foo = %d\n", *ap);
48 result = 1;
50 if (*bp != 2)
52 printf ("bar = %d\n", *bp);
53 result = 1;
55 if (*cp != 3)
57 printf ("baz = %d\n", *cp);
58 result = 1;
61 return result;