x86_64: Fix missing wcsncat function definition without multiarch (x86-64-v4)
[glibc.git] / elf / tst-tlsmod1.c
bloba448c4dc37eaf01b94ee87a4d2987381c2960fe5
1 #include <stdio.h>
4 __thread int foo, bar __attribute__ ((tls_model("global-dynamic")));
5 extern __thread int baz __attribute__ ((tls_model("global-dynamic")));
6 extern __thread int foo_ie asm ("foo") __attribute__ ((tls_model("initial-exec")));
7 extern __thread int bar_ie asm ("bar") __attribute__ ((tls_model("initial-exec")));
8 extern __thread int baz_ie asm ("baz") __attribute__ ((tls_model("initial-exec")));
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 = &foo_ie;
23 bp = &bar_ie;
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 or TLSDESC. */
39 fputs ("get sum of foo and bar and baz (GD or TLSDESC)", stdout);
40 ap = &foo;
41 bp = &bar;
42 cp = &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;