[PATCH 2/5] [PowerPC64] Set up thread register for _dl_relocate_static_pie
Paul E Murphy
murphyp@linux.ibm.com
Wed Feb 16 23:02:51 GMT 2022
On 1/23/22 9:47 PM, Alan Modra via Libc-alpha wrote:
> On Sun, Jan 23, 2022 at 11:12:13PM +1030, Alan Modra wrote:
>> There's a serious problem in libgcc too. libgcc ifuncs access the
>> AT_HWCAP words stored in the tcb with an offset from the thread
>> pointer (r13), but r13 isn't set at the time _dl_relocate_static_pie
>> runs, and I'm loathe to try calling init_tls early. A better approach
>> that might work is to fake r13 so that _dl_hwcap is at the expected
>> offset where we'd normally find the tcb hwcap words.
>
> Like this.
>
> libgcc ifunc resolvers that access hwcap via a field in the tcb can't
> be called until the thread pointer is set up. This patch sets up a
> fake thread pointer early so that static-pies won't segfault on
> attempting to relocate themselves.
>
I suspect the thread pointer needs to be setup more. How much, I am not
sure.
Looking into the failure of tst-tlsifunc-static, we would need similar
access to at_platform when resolving ifunc for similar reasons of hwcap.
That seems like an easy fix.
However, I am not sure what to make of the other failure in this test.
A pointer into tls is created as part of running an ifunc resolver. Do
we need to preserve that behavior?
More information about the Libc-alpha
mailing list