* H. J. Lu:

> On Sat, Nov 22, 2025 at 5:33 AM Florian Weimer <[email protected]> wrote:
>>
>> * Richard Biener:
>>
>> > +/* When the glibc we build against does not have dl_find_object 
>> > tentatively
>> > +   declare the relevant bits of the structure here and use a weak 
>> > declaration
>> > +   so we can perform a runtime check on its presence.  */
>> > +#if !defined(DLFO_STRUCT_HAS_EH_DBASE)
>>
>> I agree with Jakub that this should be restricted to __GLIBC__.
>>
>> This works for the narrow case that _dl_find_object is not available at
>> build time and becomes available at run time.  Extending this to make it
>> optional at run time when it was available and build time does not work
>> quite work because BFD ld does not support weak symbol versions (the
>
> If a symbol isn't available at link-time, how can it be versioned?

The problem is that if it is available at link time, the GLIBC_2.35
symbol version reference is always strong, even if the _dl_find_object
symbol that triggers its create is weak.  We have VER_FLG_WEAK, and I
think glibc tries to handle it (but we don't test it today).  However
BFD ld never sets it.

Due to this binutils limitation, it's not possible to add

#pragma weak _dl_find_object

and build on glibc 2.35+, and run on earlier versions (with an
appropriate null check on _dl_find_object).

Thanks,
Florian

Reply via email to