1 /* glibc test for TLS in ld.so. */
5 __thread
int foo
, bar
__attribute__ ((tls_model("local-exec")));
6 extern __thread
int foo_gd
asm ("foo") __attribute__ ((tls_model("global-dynamic")));
7 extern __thread
int foo_ld
asm ("foo") __attribute__ ((tls_model("local-dynamic")));
8 extern __thread
int foo_ie
asm ("foo") __attribute__ ((tls_model("initial-exec")));
9 extern __thread
int bar_gd
asm ("bar") __attribute__ ((tls_model("global-dynamic")));
10 extern __thread
int bar_ld
asm ("bar") __attribute__ ((tls_model("local-dynamic")));
11 extern __thread
int bar_ie
asm ("bar") __attribute__ ((tls_model("initial-exec")));
20 /* Set the variable using the local exec model. */
21 puts ("set bar to 1 (LE)");
25 /* Get variables using initial exec model. */
26 fputs ("get sum of foo and bar (IE)", stdout
);
29 printf (" = %d\n", *ap
+ *bp
);
30 result
|= *ap
+ *bp
!= 1;
31 if (*ap
!= 0 || *bp
!= 1)
33 printf ("foo = %d\nbar = %d\n", *ap
, *bp
);
38 /* Get variables using local dynamic model or TLSDESC. */
39 fputs ("get sum of foo and bar (LD or TLSDESC)", stdout
);
42 printf (" = %d\n", *ap
+ *bp
);
43 result
|= *ap
+ *bp
!= 1;
44 if (*ap
!= 0 || *bp
!= 1)
46 printf ("foo = %d\nbar = %d\n", *ap
, *bp
);
51 /* Get variables using general dynamic model or TLSDESC. */
52 fputs ("get sum of foo and bar (GD or TLSDESC)", stdout
);
55 printf (" = %d\n", *ap
+ *bp
);
56 result
|= *ap
+ *bp
!= 1;
57 if (*ap
!= 0 || *bp
!= 1)
59 printf ("foo = %d\nbar = %d\n", *ap
, *bp
);
68 #include <support/test-driver.c>