i386: Change offset of __private_ss to 0x30 [BZ #23250]
[glibc.git] / elf / tst-tls3.c
blob7e0abb4c58c8ff503319cc1ae3c04d7c9bb6eb61
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 static int
17 do_test (void)
19 int result = 0;
20 int *ap, *bp, *cp;
23 /* Set the variable using the local exec model. */
24 puts ("set baz to 3 (LE)");
25 ap = TLS_LE (baz);
26 *ap = 3;
29 /* Get variables using initial exec model. */
30 puts ("set variables foo and bar (IE)");
31 ap = TLS_IE (foo);
32 *ap = 1;
33 bp = TLS_IE (bar);
34 *bp = 2;
37 /* Get variables using local dynamic model. */
38 fputs ("get sum of foo, bar (GD) and baz (LD)", stdout);
39 ap = TLS_GD (foo);
40 bp = TLS_GD (bar);
41 cp = TLS_LD (baz);
42 printf (" = %d\n", *ap + *bp + *cp);
43 result |= *ap + *bp + *cp != 6;
44 if (*ap != 1)
46 printf ("foo = %d\n", *ap);
47 result = 1;
49 if (*bp != 2)
51 printf ("bar = %d\n", *bp);
52 result = 1;
54 if (*cp != 3)
56 printf ("baz = %d\n", *cp);
57 result = 1;
61 result |= in_dso ();
63 return result;
67 #include <support/test-driver.c>