[PATCH v3] RISC-V: Fix IFUNC resolver cannot access gp pointer
Yangyu Chen
cyy@cyyself.name
Thu Jan 9 09:07:47 GMT 2025
On 1/9/25 16:45, Andreas Schwab wrote:
> On Jan 09 2025, Yangyu Chen wrote:
>
>> But here I have a question: Why is looking up global_pointer in .dynsym,
>> which is literally a SHN_ABS typed value (but we should add l_addr to it
>> before use), not safe during relocation? IIRC, it does not require dynamic
>> symbol resolution. Am I missing something?
>
> See bug 31317 for a test case. Before relocation, any reference to
> static data is undefined.
>
If that only happens on static-pie, then I think this time I have
wrapped these codes with `#ifdef SHARED` would be a suitable solution.
As gp will be setup at very early stage for static build, we also don't
need to setup gp for static elf here.
Thanks,
Yangyu Chen
More information about the Libc-alpha
mailing list