elf/tst-tlsopt-powerpc fails when compiled with -mcpu=power10 (BZ# 29776)
authorAlan Modra <amodra@gmail.com>
Sat, 12 Nov 2022 00:50:31 +0000 (11:20 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 14 Nov 2022 11:34:25 +0000 (22:04 +1030)
Supports pcrel addressing of TLS GOT entry.  Also tweak the non-pcrel
asm constraint to better reflect how the reg is used.

sysdeps/powerpc/mod-tlsopt-powerpc.c

index 2a82e53..d941024 100644 (file)
@@ -22,7 +22,11 @@ tls_get_addr_opt_test (void)
   tls_index *tls_arg;
 #ifdef __powerpc64__
   register unsigned long thread_pointer __asm__ ("r13");
-  asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg));
+# ifdef __PCREL__
+  asm ("paddi %0,0,foo@got@tlsgd@pcrel,1" : "=b" (tls_arg));
+# else
+  asm ("addi %0,2,foo@got@tlsgd" : "=b" (tls_arg));
+# endif
 #else
   register unsigned long thread_pointer __asm__ ("r2");
   asm ("bcl 20,31,1f\n1:\t"