[PATCH 2/2] aarch64: Add workaround for GDB bug handling string literals

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Jun 30 16:15:04 GMT 2026



On 30/06/26 12:29, Yury Khrustalev wrote:
> On Tue, Jun 30, 2026 at 12:17:37PM -0300, Adhemerval Zanella Netto wrote:
>>
>> On 30/06/26 11:15, Wilco Dijkstra wrote:
>>> Hi,
>>>
>>>> I don't like it either, but I don't see a better alternative to keep some
>>>> compatibility with old gdb.
>>>>
>>>> But I also think this approach is fragile: it require some assumptions on how
>>>> gdb implements this and adds some magic number.� I think a better alternative
>>>> is invert the assumption: the only exactly legitimate caller of an IFUNC
>>>> resolver is the the dynamic loader's relocation machinery
>>>> (elf_ifunc_invoke / _dl_fixup):
>>>
>>> On AArch64 we can just check for !(arg0 & IFUNC_ARG_HWCAP) since we always
>>> invoke ifuncs with that bit set from GLIBC (obviously the value is way too large to
>>> ever be a valid allocation). You could also check arg0 == GLRO (dl_hwcap) for other
>>> targets.
> 
> Yes, we should do this, I'll make a patch.

I think if we want to add this workaround, doing in a platform neutral is better
than adding arch-specific knobs.

> 
>>
>> This adds extra complexity for debuggers to have arch-specific knowledge of
>> how ifunc works when called directly.  Doable, but it is essentially another
>> undocumented semantic. 
> 
> The idea is to abort if !(arg0 & IFUNC_ARG_HWCAP) is true with a clear
> error message. This is not to work-around the issue in GDB but to make
> the error explicit and clear. No complexity, no arch-specific knowledge.
> 
> Thanks,
> Yury



More information about the Libc-alpha mailing list