Get rid of Versions.def source file
[glibc.git] / elf / tst-tls3.c
blobca96c6a073c1b47353a1fdcb8c43d7743a8fd603
1 /* glibc test for TLS in ld.so. */
2 #include <stdio.h>
4 #include "tls-macros.h"
7 /* One define int variable, two externs. */
8 COMMON_INT_DECL(foo);
9 VAR_INT_DECL(bar);
10 VAR_INT_DEF(baz);
13 extern int in_dso (void);
16 #define TEST_FUNCTION do_test ()
17 static int
18 do_test (void)
20 int result = 0;
21 int *ap, *bp, *cp;
24 /* Set the variable using the local exec model. */
25 puts ("set baz to 3 (LE)");
26 ap = TLS_LE (baz);
27 *ap = 3;
30 /* Get variables using initial exec model. */
31 puts ("set variables foo and bar (IE)");
32 ap = TLS_IE (foo);
33 *ap = 1;
34 bp = TLS_IE (bar);
35 *bp = 2;
38 /* Get variables using local dynamic model. */
39 fputs ("get sum of foo, bar (GD) and baz (LD)", stdout);
40 ap = TLS_GD (foo);
41 bp = TLS_GD (bar);
42 cp = TLS_LD (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;
62 result |= in_dso ();
64 return result;
68 #include "../test-skeleton.c"