1feee8
commit d0e2ac0c5902bd0e671863cc6cb14024d0365e67
1feee8
Author: Alan Modra <amodra@gmail.com>
1feee8
Date:   Sat Nov 12 11:20:31 2022 +1030
1feee8
1feee8
    elf/tst-tlsopt-powerpc fails when compiled with -mcpu=power10 (BZ# 29776)
1feee8
    
1feee8
    Supports pcrel addressing of TLS GOT entry.  Also tweak the non-pcrel
1feee8
    asm constraint to better reflect how the reg is used.
1feee8
    
1feee8
    (cherry picked from commit 94628de77888c3292fc103840731ff85f283368e)
1feee8
1feee8
diff --git a/sysdeps/powerpc/mod-tlsopt-powerpc.c b/sysdeps/powerpc/mod-tlsopt-powerpc.c
1feee8
index ee0db12a737d6ab5..51cc502f2860e969 100644
1feee8
--- a/sysdeps/powerpc/mod-tlsopt-powerpc.c
1feee8
+++ b/sysdeps/powerpc/mod-tlsopt-powerpc.c
1feee8
@@ -24,7 +24,11 @@ tls_get_addr_opt_test (void)
1feee8
   tls_index *tls_arg;
1feee8
 #ifdef __powerpc64__
1feee8
   register unsigned long thread_pointer __asm__ ("r13");
1feee8
-  asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg));
1feee8
+# ifdef __PCREL__
1feee8
+  asm ("paddi %0,0,foo@got@tlsgd@pcrel,1" : "=b" (tls_arg));
1feee8
+# else
1feee8
+  asm ("addi %0,2,foo@got@tlsgd" : "=b" (tls_arg));
1feee8
+# endif
1feee8
 #else
1feee8
   register unsigned long thread_pointer __asm__ ("r2");
1feee8
   asm ("bcl 20,31,1f\n1:\t"