Fix warnings in __bswap_16.
[glibc.git] / elf / tst-tls3.c
blobc5e501eb4ee37f8a7e98f1ae800c4f05dfcef6e3
1 /* glibc test for TLS in ld.so. */
2 #include <stdio.h>
4 #include <tls.h>
6 #include "tls-macros.h"
9 /* One define int variable, two externs. */
10 COMMON_INT_DECL(foo);
11 VAR_INT_DECL(bar);
12 VAR_INT_DEF(baz);
15 extern int in_dso (void);
18 #define TEST_FUNCTION do_test ()
19 static int
20 do_test (void)
22 int result = 0;
23 int *ap, *bp, *cp;
26 /* Set the variable using the local exec model. */
27 puts ("set baz to 3 (LE)");
28 ap = TLS_LE (baz);
29 *ap = 3;
32 /* Get variables using initial exec model. */
33 puts ("set variables foo and bar (IE)");
34 ap = TLS_IE (foo);
35 *ap = 1;
36 bp = TLS_IE (bar);
37 *bp = 2;
40 /* Get variables using local dynamic model. */
41 fputs ("get sum of foo, bar (GD) and baz (LD)", stdout);
42 ap = TLS_GD (foo);
43 bp = TLS_GD (bar);
44 cp = TLS_LD (baz);
45 printf (" = %d\n", *ap + *bp + *cp);
46 result |= *ap + *bp + *cp != 6;
47 if (*ap != 1)
49 printf ("foo = %d\n", *ap);
50 result = 1;
52 if (*bp != 2)
54 printf ("bar = %d\n", *bp);
55 result = 1;
57 if (*cp != 3)
59 printf ("baz = %d\n", *cp);
60 result = 1;
64 result |= in_dso ();
66 return result;
70 #include "../test-skeleton.c"