PR27128, nm -P portable output format regression

H.J. Lu hjl.tools@gmail.com
Thu Dec 31 18:15:02 GMT 2020


On Thu, Dec 31, 2020 at 10:02 AM Fangrui Song <i@maskray.me> wrote:
>
> On 2020-12-31, Alan Modra via Binutils wrote:
> >On Wed, Dec 30, 2020 at 06:10:34AM -0800, H.J. Lu wrote:
> >> I think they are useful.   Here is a patch to add tests.
> >
> >Fails on mips due to mips overriding .byte and then foo and _Zrm1XS_
> >having the same address.  Which is quite weird.  This results in -n
> >sort not ordering the symbols as expected.  I'm modifying the tests to
> >use .space 16 instead.
> >
> >Also, this
> >> +VERS_2.0 +|0+| +A +| +|0+1|.*
> >matches anything.  I'm adding backslash escapes to match literal '|'
> >and '.', plus correcting the sysv expected lines.
> >
> >Committed.
> >
> >binutils/
> >       PR 27128
> >       * nm.c (print_symname): Append version string to symbol name
> >       before printing the lot under control of "form".  Append version
> >       to demangled names too.
> >ld/
> >       PR 27128
> >       * testsuite/ld-elf/pr27128.s: New file.
> >       * testsuite/ld-elf/pr27128.t: Likewise.
> >       * testsuite/ld-elf/pr27128a.d: Likewise.
> >       * testsuite/ld-elf/pr27128b.d: Likewise.
> >       * testsuite/ld-elf/pr27128c.d: Likewise.
> >       * testsuite/ld-elf/pr27128d.d: Likewise.
> >       * testsuite/ld-elf/pr27128e.d: Likewise.
>
> Oh, I did not know "gas: Extend .symver directive" (`.symver ... , remove`) has been committed.
>
> `remove` will pretty much be always preferred
> (https://maskray.me/blog/2020-11-26-all-about-symbol-versioning#Assembler-behavior)

It has been checked into binutils 2.35:

ommit 6914be53bd662eefd979d0c82d2e20e108c4ee66
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Apr 21 05:33:04 2020 -0700

    gas: Extend .symver directive

    Extend .symver directive to update visibility of the original symbol and
    assign one original symbol to different versioned symbols:

      .symver foo, foo@VERS_1, local    # Change foo to a local symbol.
      .symver foo, foo@VERS_2, hidden   # Change foo to a hidden symbol.
      .symver foo, foo@@VERS_3, remove  # Remove foo from symbol table.
      .symver foo, bar@V1               # Assign foo to bar@V1 and baz@V2.
      .symver foo, baz@V2

I don't think we need to make any changes now.

> However, it can be confusing. Instead of adding an optional argument to .symver, what about adding a new directive?
>
>
>
> Note that copying attributes (.symver) isn't traditional behavior: for .set foo, bar, the visibility/binding bits of foo and bar are separate.
> The new directive can just do renaming.



-- 
H.J.


More information about the Binutils mailing list