public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] elf: Don't set VER_FLG_WEAK
@ 2022-01-26  0:19 H.J. Lu
  2022-01-26  3:07 ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2022-01-26  0:19 UTC (permalink / raw)
  To: binutils

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.

	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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] elf: Don't set VER_FLG_WEAK
  2022-01-26  0:19 [PATCH] elf: Don't set VER_FLG_WEAK H.J. Lu
@ 2022-01-26  3:07 ` Alan Modra
  2022-01-26 13:26   ` H.J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2022-01-26  3:07 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils

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.

> 	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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] elf: Don't set VER_FLG_WEAK
  2022-01-26  3:07 ` Alan Modra
@ 2022-01-26 13:26   ` H.J. Lu
  2022-01-31 16:47     ` Florian Weimer
  0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2022-01-26 13:26 UTC (permalink / raw)
  To: Alan Modra, Florian Weimer; +Cc: Binutils

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] elf: Don't set VER_FLG_WEAK
  2022-01-26 13:26   ` H.J. Lu
@ 2022-01-31 16:47     ` Florian Weimer
  2022-01-31 18:19       ` H.J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2022-01-31 16:47 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Alan Modra, Binutils

* H. J. Lu:

> 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?

I may have been overly cautious, influenced by the old link editor
behavior which copied the weak flag of dynamic symbols from the
definitions to their references.  But it's indeed unclear how this could
happen here.  If it did, we would lose the coverage check in the glibc
dynamic loader for that symbol version, I think.  (The loader only
checks vna_flags in two places, once for printing the flag, and once to
skip an error report in case of a missing version.)

Do you suggest we should start using weak symbol version definitions in
glibc, and not worry about it?

Thanks,
Florian


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] elf: Don't set VER_FLG_WEAK
  2022-01-31 16:47     ` Florian Weimer
@ 2022-01-31 18:19       ` H.J. Lu
  0 siblings, 0 replies; 6+ messages in thread
From: H.J. Lu @ 2022-01-31 18:19 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Alan Modra, Binutils

On Mon, Jan 31, 2022 at 8:48 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > 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?
>
> I may have been overly cautious, influenced by the old link editor
> behavior which copied the weak flag of dynamic symbols from the
> definitions to their references.  But it's indeed unclear how this could
> happen here.  If it did, we would lose the coverage check in the glibc
> dynamic loader for that symbol version, I think.  (The loader only
> checks vna_flags in two places, once for printing the flag, and once to
> skip an error report in case of a missing version.)
>
> Do you suggest we should start using weak symbol version definitions in
> glibc, and not worry about it?

Let's use the symbol versions without any symbols in glibc after
glibc 2.35 is released.  It will create symbol versions with
VER_FLG_WEAK.  If it will cause any issues, we can change linker
to remove VER_FLG_WEAK from empty symbol versions.

> Thanks,
> Florian
>


-- 
H.J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] elf: Don't set VER_FLG_WEAK
@ 2022-02-01  8:44 Nick Clifton
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2022-02-01  8:44 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils

Hi H.J.

   Patch approved - please apply.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-01  8:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  0:19 [PATCH] elf: Don't set VER_FLG_WEAK H.J. Lu
2022-01-26  3:07 ` Alan Modra
2022-01-26 13:26   ` H.J. Lu
2022-01-31 16:47     ` Florian Weimer
2022-01-31 18:19       ` H.J. Lu
2022-02-01  8:44 Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).