1 /* glibc test for __tls_get_addr optimization. */
4 #include "../../elf/tls-macros.h"
7 /* common 'int' variable in TLS. */
11 #define TEST_FUNCTION do_test ()
17 /* Get variable using general dynamic model. */
18 int *ap
= TLS_GD (foo
);
21 printf ("foo = %d\n", *ap
);
27 register unsigned long thread_pointer
__asm__ ("r13");
28 asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg
));
30 register unsigned long thread_pointer
__asm__ ("r2");
31 asm ("bcl 20,31,1f\n1:\t"
33 "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"
34 "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"
35 "addi %0,%0,foo@got@tlsgd" : "=b" (tls_arg
));
38 if (tls_arg
->ti_module
!= 0)
40 printf ("tls_index not optimized, binutils too old?\n");
43 else if (tls_arg
->ti_offset
+ thread_pointer
!= (unsigned long) ap
)
45 printf ("tls_index->ti_offset wrong value\n");
52 #include "../../test-skeleton.c"