[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-08-07 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

--- Comment #11 from H.J. Lu  ---
(In reply to Michael Matz from comment #10)
> (In reply to H.J. Lu from comment #9)
> > > 
> > > Is it really a good idea to change the output format of basic tools that
> > > might be
> > > used in machine processing context?  (And I note there doesn't seem to be 
> > > an
> > > cmdline option to get the old behaviour back, so fixing the problem now
> > > entails
> > > further massaging of nm output to cut off /@.*/ )
> > 
> > Is this PR 26302?  A patch is at
> 
> No.  perf does the moral equivalent of:
> 
> % ( echo "{"; nm -D input.so | awk '{print $1";"}'; echo "}" ) > thelist
> % ld ... --dynamic-list=thelist
> 

Please a new bug report with a small testcase.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-08-07 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

--- Comment #10 from Michael Matz  ---
(In reply to H.J. Lu from comment #9)
> > 
> > Is it really a good idea to change the output format of basic tools that
> > might be
> > used in machine processing context?  (And I note there doesn't seem to be an
> > cmdline option to get the old behaviour back, so fixing the problem now
> > entails
> > further massaging of nm output to cut off /@.*/ )
> 
> Is this PR 26302?  A patch is at

No.  perf does the moral equivalent of:

% ( echo "{"; nm -D input.so | awk '{print $1";"}'; echo "}" ) > thelist
% ld ... --dynamic-list=thelist

Of course 'thelist' now contains @ characters, because nm -D shows symversions,
and that's what ld is complaining about:

thelist:2: ignoring invalid character `@' in script
thelist:2: syntax error in dynamic list
collect2: error: ld returned 1 exit status

The build system of simply isn't prepared to deal with these symversions.
So one of several things need to happen:
a) nm -D doesn't print symversions, unless explicitely requested
b) nm -D continues to print them, but with an option to disable them
c) perf Makefile is changed to filter out any /@.*/ in the nm output

I'm not sure how widespread such usage of nm is, and hence how often fix (c)
would have to be applied in the wild.  Fixing such packages would at least
be easier if nm had an option to disable printing them (i.e. (b)).  But maybe
it's best to not change traditional behaviour of nm at all, i.e. change (a),
and revert to not printing symversions by default.

I don't know what's best.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-08-07 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

--- Comment #9 from H.J. Lu  ---
(In reply to Michael Matz from comment #8)
> This breaks at least the perf build from linux kernel 5.7 as nm is used to
> construct a symbol list for feeding into ld, which now contains '@'
> characters
> which aren't liked by ld (of course).  See e.g.
> 
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1887397
> 
> Is it really a good idea to change the output format of basic tools that
> might be
> used in machine processing context?  (And I note there doesn't seem to be an
> cmdline option to get the old behaviour back, so fixing the problem now
> entails
> further massaging of nm output to cut off /@.*/ )

Is this PR 26302?  A patch is at

https://sourceware.org/pipermail/binutils/2020-July/112556.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-08-07 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

Michael Matz  changed:

   What|Removed |Added

 CC||matz at suse dot de

--- Comment #8 from Michael Matz  ---
This breaks at least the perf build from linux kernel 5.7 as nm is used to
construct a symbol list for feeding into ld, which now contains '@' characters
which aren't liked by ld (of course).  See e.g.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1887397

Is it really a good idea to change the output format of basic tools that might
be
used in machine processing context?  (And I note there doesn't seem to be an
cmdline option to get the old behaviour back, so fixing the problem now entails
further massaging of nm output to cut off /@.*/ )

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-03-24 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

H.J. Lu  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #7 from H.J. Lu  ---
Fixed

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-03-24 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

--- Comment #6 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1081065c519d1bfc3847bf4b0a0ce4bc3224bcd3

commit 1081065c519d1bfc3847bf4b0a0ce4bc3224bcd3
Author: H.J. Lu 
Date:   Tue Mar 24 15:37:14 2020 -0700

bfd: Add a bfd_boolean argument to bfd_get_symbol_version_string

We can't call _bfd_elf_get_symbol_version_name from nm.c since it isn't
available for all target configurations.  This patch add a bfd_boolean
argument to bfd_get_symbol_version_string instead.

bfd/

PR binutils/25708
* elf-bfd.h (_bfd_elf_get_symbol_version_name): Renamed to ...
(_bfd_elf_get_symbol_version_string): This.
* elf.c (_bfd_elf_get_symbol_version_name): Renamed to ...
(_bfd_elf_get_symbol_version_string): This.
(bfd_elf_print_symbol): Pass TRUE to
_bfd_elf_get_symbol_version_string.
* libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Add a
bfd_boolean argument.
* syms.c (_bfd_nosymbols_get_symbol_version_string): Likewise.
* targets.c  (_bfd_get_symbol_version_string): Likewise.
(bfd_get_symbol_version_string): Likewise.
* bfd-in2.h: Regenerated.

binutils/

PR binutils/25708
* nm.c (print_symname): Replace _bfd_elf_get_symbol_version_name
with bfd_get_symbol_version_string.
(print_symbo): Pass TRUE to bfd_get_symbol_version_string.
* objdump.c (objdump_print_symname): Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-03-24 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

H.J. Lu  changed:

   What|Removed |Added

 Status|REOPENED|NEW

--- Comment #5 from H.J. Lu  ---
(In reply to Nick Clifton from comment #4)
> Hi H.J.
> 
>   Oops - I have just noticed some build failures from non-ELF based
>   targets, eg alpha-dec-vms and i386=pc-go32:
> 
> /bin/ld: nm.o: in function `print_symname':
> binutils/nm.c:420: undefined reference to
> `_bfd_elf_get_symbol_version_name'
> 
>   Please could you have a look into this.

Here is the patch:

https://sourceware.org/pipermail/binutils/2020-March/110366.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-03-24 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

Nick Clifton  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||nickc at redhat dot com
 Resolution|FIXED   |---

--- Comment #4 from Nick Clifton  ---
Hi H.J.

  Oops - I have just noticed some build failures from non-ELF based
  targets, eg alpha-dec-vms and i386=pc-go32:

/bin/ld: nm.o: in function `print_symname':
binutils/nm.c:420: undefined reference to
`_bfd_elf_get_symbol_version_name'

  Please could you have a look into this.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-03-24 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
   Target Milestone|--- |2.35
 Resolution|--- |FIXED

--- Comment #3 from H.J. Lu  ---
Fixed for 2.35.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-03-24 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

--- Comment #2 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7e6e972f74aeac0ebdbd95a7f905d871cd2581de

commit 7e6e972f74aeac0ebdbd95a7f905d871cd2581de
Author: H.J. Lu 
Date:   Tue Mar 24 04:23:11 2020 -0700

bfd: Display symbol version for nm -D

Extend _bfd_elf_get_symbol_version_string for nm -D to display symbol
version.  _bfd_elf_get_symbol_version_name is added to avoid updating
all XXX_get_symbol_version_string functions.

bfd/

PR binutils/25708
* elf-bfd.h (_bfd_elf_get_symbol_version_name): New.
* elf.c (_bfd_elf_get_symbol_version_name): New function.  Based
on the previous _bfd_elf_get_symbol_version_string.
(_bfd_elf_get_symbol_version_string): Use it.

binutils/

PR binutils/25708
* nm.c (SYM_NAME): Removed.
(print_symname): Add a pointer to struct extended_symbol_info
argument.  Call _bfd_elf_get_symbol_version_name to get symbol
version.
(print_symdef_entry): Pass NULL to print_symname.
(print_symbol_info_bsd): Update call to print_symname.
(print_symbol_info_sysv): Likewise.
(print_symbol_info_posix): Likewise.

ld/

PR binutils/25708
* testsuite/ld-elf/pr25708.d: New file.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25708] nm -D doesn't display symbol version for dynamic symbols

2020-03-22 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25708

H.J. Lu  changed:

   What|Removed |Added

URL||https://sourceware.org/pipe
   ||rmail/binutils/2020-March/1
   ||10333.html

--- Comment #1 from H.J. Lu  ---
A patch is posted at

https://sourceware.org/pipermail/binutils/2020-March/110333.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.