tls_get_addr_opt_test in sysdeps/powerpc/mod-tlsopt-powerpc.c contains: #ifdef __powerpc64__ register unsigned long thread_pointer __asm__ ("r13"); asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg)); #else If I'm not mistaken, this assumes that r2 is the TOC register. However, when building in PCREL mode (e.g., with CC="gcc -mcpu=power10"), there is no TOC register for this function. In fact, r2 is zero, and we get a crash for the tls_arg->ti_module != 0 check.
Created attachment 14451 [details] untested patch This should fix it. Note that I haven't actually run a glibc regression test on a power10 box, just looked at generated code.
Tested the patch on power10 with flag -mcpu=power10 and it fixed elf/tst-tlsopt-powerpc failure.
(In reply to Alan Modra from comment #1) > Created attachment 14451 [details] > untested patch > > This should fix it. Note that I haven't actually run a glibc regression > test on a power10 box, just looked at generated code. (In reply to Rajalakshmi from comment #2) > Tested the patch on power10 with flag -mcpu=power10 and it fixed > elf/tst-tlsopt-powerpc failure. Thanks! Could we please merge this into the master branch?
pushed commit 94628de77888