[PATCH] elf: Don't set VER_FLG_WEAK

H.J. Lu hjl.tools@gmail.com
Wed Jan 26 13:26:34 GMT 2022


On Tue, Jan 25, 2022 at 7:07 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Tue, Jan 25, 2022 at 04:19:53PM -0800, H.J. Lu via Binutils wrote:
> > On Solaris, VER_FLG_WEAK indicates a weak version definition with no
> > symbols associated with it.  It is used to verify the existence of a
> > particular implementation without any symbol references to the weak
> > version.  Don't set VER_FLG_WEAK since it is unused in binutils.
>
> Can you tell me why the presence of this flag is bad?  I don't see it
> affecting anything in binutils or glibc.  VER_FLG_WEAK in version refs
> does affect resolution of symbol, but I can't see how a VER_FLG_WEAK
> in a version def can transfer over to a ref if the def is unused.

Florian,  can you share the reason why Linux doesn't want
VER_FLG_WEAK on the empty version?

Thanks.

> >       PR ld/28814
> >       * elflink.c (bfd_elf_size_dynamic_sections): Don't set
> >       VER_FLG_WEAK.
> > ---
> >  bfd/elflink.c | 4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/bfd/elflink.c b/bfd/elflink.c
> > index 2677561478d..ffb4506958f 100644
> > --- a/bfd/elflink.c
> > +++ b/bfd/elflink.c
> > @@ -6921,10 +6921,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
> >
> >             def.vd_version = VER_DEF_CURRENT;
> >             def.vd_flags = 0;
> > -           if (t->globals.list == NULL
> > -               && t->locals.list == NULL
> > -               && ! t->used)
> > -             def.vd_flags |= VER_FLG_WEAK;
> >             def.vd_ndx = t->vernum + (info->create_default_symver ? 2 : 1);
> >             def.vd_cnt = cdeps + 1;
> >             def.vd_hash = bfd_elf_hash (t->name);
> > --
> > 2.34.1
>
> --
> Alan Modra
> Australia Development Lab, IBM



-- 
H.J.


More information about the Binutils mailing list