Re: [PATCH] lto: Set resolution to LDPR_PREVAILING_DEF for non-IR common symbol

Jan Beulich <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
On 27.08.2026 14:04, H.J. Lu wrote:
> On Thu, Aug 27, 2026 at 7:52 PM Jan Beulich <[email protected]> wrote:
>>
>> On 27.08.2026 10:31, H.J. Lu wrote:
>>> Since size or alignment of common symbol may be overridden by another
>>> common symbol, set symbol resolution to LDPR_PREVAILING_DEF, instead of
>>> LDPR_RESOLVED_EXEC, for common symbol in regular object when seeing an
>>> undefined or common symbol from an IR object.
>>
>> Is this correct for the LDPK_COMMON case that's also covered by the if()
>> that you alter in get_symbols()?
> 
> My patch covers the case of
> 
> syms[n].def == LDPK_COMMON && blhe->type == bfd_link_hash_common.
> 
> which wasn't handled before.

Right, but that doesn't answer my question, hinting towards a situation where
two instances of a common symbol collide. And I can't really resolve that for
myself because ...

>> Adding to the (my?) confusion is that after said
>>
>>       if (syms[n].def == LDPK_UNDEF
>>           || syms[n].def == LDPK_WEAKUNDEF
>>           || syms[n].def == LDPK_COMMON)
>>
>> there's an "else if" with this comment:
>>
>>       /* Was originally def, weakdef, or common, but has been pre-empted.  */
>>
>> With the cited if(), no originally common symbol can make it there, can it?

... there's this comment which irritates me.

> My patch covers
> 
>       if (syms[n].def == LDPK_UNDEF
>           || syms[n].def == LDPK_WEAKUNDEF
>           || syms[n].def == LDPK_COMMON)
>         {
>              ...
> 
> It has nothing to do with the else clause.

Correct, and I didn't mean to say anything to the contrary.

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.