[PATCH] ld: Keep indirect symbol from IR if referenced from shared object

Alan Modra amodra@gmail.com
Mon Feb 14 02:47:29 GMT 2022


On Sun, Feb 13, 2022 at 04:16:35PM -0800, H.J. Lu wrote:
> On Fri, Feb 11, 2022 at 3:19 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > Don't change indirect symbol defined in IR to undefined if it is
> > referenced from shared object.

The description above

> > diff --git a/bfd/elflink.c b/bfd/elflink.c
> > index 6fa18d92007..f8521426cad 100644
> > --- a/bfd/elflink.c
> > +++ b/bfd/elflink.c
> > @@ -1294,9 +1294,8 @@ _bfd_elf_merge_symbol (bfd *abfd,
> >           h->root.non_ir_ref_dynamic = true;
> >           hi->root.non_ir_ref_dynamic = true;
> >         }
> > -
> > -      if ((oldbfd->flags & BFD_PLUGIN) != 0
> > -         && hi->root.type == bfd_link_hash_indirect)
> > +      else if ((oldbfd->flags & BFD_PLUGIN) != 0
> > +              && hi->root.type == bfd_link_hash_indirect)
> >         {
> >           /* Change indirect symbol from IR to undefined.  */
> >           hi->root.type = bfd_link_hash_undefined;

and the patch do not exactly match.  The code logic is old sym
indirect in IR, new sym not IR, both in shared library *or both not*.
Is that correct?

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list