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

"H.J. Lu" <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <CAMe9rOrZs557j7f7xsMmAU=TgHO=5nbcM0vg8t8Hcqk8iYQzGw@mail.gmail.com>
On Fri, Aug 28, 2026 at 2:00 PM Alan Modra <[email protected]> wrote:
>
> On Thu, Aug 27, 2026 at 04:31:43PM +0800, 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.
> >
> >       PR ld/34570
> >       * plugin.c (get_symbols): Set resolution to LDPR_PREVAILING_DEF
> >       for common symbol in regular object.
> >       * testsuite/ld-plugin/pr34570a.c: New file.
> >       * testsuite/ld-plugin/pr34570a.d: Likewise.
> >       * testsuite/ld-plugin/pr34570b.c: Likewise.
> >       * testsuite/ld-plugin/pr34570b.d: Likewise.
> >       * testsuite/ld-plugin/pr34570c.c: Likewise.
> >       * testsuite/ld-plugin/pr34570c.d: Likewise.
>
> OK.  Would you please also apply the following along with your patch,
> if you agree that this comment is incorrect regarding "or common" and
> therefore confusing and unnecessary given the earlier comment.

Will do.

Thanks.

> diff --git a/ld/plugin.c b/ld/plugin.c
> index 1cf5c915b00..e221e414db5 100644
> --- a/ld/plugin.c
> +++ b/ld/plugin.c
> @@ -871,8 +871,6 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms,
>         res = LDPR_PREEMPTED_REG;
>        else if (owner_sec->owner == abfd)
>         res = LDPR_PREVAILING_DEF_IRONLY;
> -
> -      /* Was originally def, weakdef, or common, but has been pre-empted.  */
>        else if (is_ir_dummy_bfd (owner_sec->owner))
>         res = LDPR_PREEMPTED_IR;
>        else
>
> --
> Alan Modra



-- 
H.J.
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.