[PATCH] nm: Remove --with-symbol-versions
H.J. Lu
hjl.tools@gmail.com
Thu Aug 13 12:45:31 GMT 2020
On Wed, Aug 12, 2020 at 10:42 PM Fangrui Song <i@maskray.me> wrote:
>
> On 2020-08-12, H.J. Lu wrote:
> >On Wed, Aug 12, 2020 at 7:42 PM Fangrui Song <i@maskray.me> wrote:
> >>
> >> "bfd: Display symbol version for nm -D" has a minor problem: an
> >> undefined symbol (e.g. strlen@GLIBC_2.2.5 in cat) should use one @,
> >> instead of two @@. nm -D output is currently inconsistent with readelf -Ws's
> >> output and ld -y's behavior.
> >>
> >
> >nm -D is consistent with readelf -sW and nm:
> >
> >[hjl@gnu-cfl-2 tmp]$ cat x.c
> >#include <stdio.h>
> >
> >void
> >foo (void)
> >{
> > printf ("foo\n");
> >}
> >[hjl@gnu-cfl-2 tmp]$ gcc -shared -fPIC x.c
> >[hjl@gnu-cfl-2 tmp]$ readelf -sW a.out | grep UND | grep @@
> > 47: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@@GLIBC_2.2.5
> > 51: 0000000000000000 0 FUNC WEAK DEFAULT UND
> >__cxa_finalize@@GLIBC_2.2.5
> >[hjl@gnu-cfl-2 tmp]$ nm a.out | grep " U " | grep @@
> > U puts@@GLIBC_2.2.5
> >[hjl@gnu-cfl-2 tmp]$ nm -D a.out | grep " U " | grep @@
> > U puts@@GLIBC_2.2.5
> >[hjl@gnu-cfl-2 tmp]$
> >
> >But readelf --dyn-syms only displays a single @
>
> puts@GLIBC_2.2.5 in .dynsym (st_name concatenated with the version string in
> .gnu.version_r) and puts@@GLIBC_2.2.5 in .symtab (st_name). This looks like
> another minor thing which should be fixed in ld.
>
> Version strings in VERNEED should use a single @.
I opened:
https://sourceware.org/bugzilla/show_bug.cgi?id=26382
--
H.J.
More information about the Binutils
mailing list