1 /* glibc test for TLS in ld.so. */
5 __thread
int foo
, bar
__attribute__ ((tls_model("initial-exec")));
6 __thread
int baz
__attribute__ ((tls_model("local-exec")));
7 extern __thread
int foo_gd
__attribute__ ((alias("foo"), tls_model("global-dynamic")));
8 extern __thread
int bar_gd
__attribute__ ((alias("bar"), tls_model("global-dynamic")));
9 extern __thread
int baz_ld
__attribute__ ((alias("baz"), tls_model("local-dynamic")));
12 extern int in_dso (void);
22 /* Set the variable using the local exec model. */
23 puts ("set baz to 3 (LE)");
27 /* Get variables using initial exec model. */
28 puts ("set variables foo and bar (IE)");
33 /* Get variables using local dynamic model. */
34 fputs ("get sum of foo, bar (GD) and baz (LD)", stdout
);
38 printf (" = %d\n", *ap
+ *bp
+ *cp
);
39 result
|= *ap
+ *bp
+ *cp
!= 6;
42 printf ("foo = %d\n", *ap
);
47 printf ("bar = %d\n", *bp
);
52 printf ("baz = %d\n", *cp
);
63 #include <support/test-driver.c>