[PATCH] nm: Remove --with-symbol-versions

H.J. Lu hjl.tools@gmail.com
Thu Aug 13 03:44:54 GMT 2020


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 @

-- 
H.J.


More information about the Binutils mailing list