diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-08-22 08:31:53 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-08-22 08:32:02 -0700 |
commit | 3f2e9699234ca31d083bc93ea6e03903f10baeaf (patch) | |
tree | bfe2e473c96a1b7c9cc4e3f9ea8bb90d2d946521 /binutils | |
parent | d19c3068ab17598662fe562e96bc1943b2b49736 (diff) | |
download | binutils-3f2e9699234ca31d083bc93ea6e03903f10baeaf.zip binutils-3f2e9699234ca31d083bc93ea6e03903f10baeaf.tar.gz binutils-3f2e9699234ca31d083bc93ea6e03903f10baeaf.tar.bz2 |
elf: Keep only one '@' for undefined versioned symbols
The symbol string table in the .symtab section is optional and cosmetic.
Keep only one '@' for undefined versioned symbols, which are defined in
shared objects, in the symbol string table. Update "nm -D" to display
only one '@' for undefined versioned symbols.
bfd/
PR ld/26382
* elflink.c (elf_link_output_symstrtab): Keep only one '@' for
versioned symbols, which are defined in shared objects, in
symbol string table.
binutils/
PR ld/26382
* nm.c (print_symname): Display only one '@' for undefined
versioned symbols.
* doc/binutils.texi: Update nm version information.
ld/
PR ld/26382
* testsuite/ld-elf/pr26302.nd: Updated.
* testsuite/ld-elf/pr26302.rd: New file.
* testsuite/ld-elf/shared.exp: Add a test for readelf -sW.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 7 | ||||
-rw-r--r-- | binutils/doc/binutils.texi | 8 | ||||
-rw-r--r-- | binutils/nm.c | 5 |
3 files changed, 18 insertions, 2 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 1f5bd36..ef4b8cb 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2020-08-22 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/26382 + * nm.c (print_symname): Display only one '@' for undefined + versioned symbols. + * doc/binutils.texi: Update nm version information. + 2020-08-21 Mark Wielaard <mark@klomp.org> * testsuite/binutils-all/readelf.exp (readelf_wi_test): Also diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 968da2c..35a5a67 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -924,7 +924,13 @@ The symbol type is unknown, or object file format specific. @end table @item -The symbol name. +The symbol name. If a symbol has version information associated with it, +then the version information is displayed as well. If the versioned +symbol is undefined or hidden from linker, the version string is displayed +as a suffix to the symbol name, preceded by an @@ character. For example +@samp{foo@@VER_1}. If the version is the default version to be used when +resolving unversioned references to the symbol, then it is displayed as a +suffix preceded by two @@ characters. For example @samp{foo@@@@VER_2}. @end itemize @c man end diff --git a/binutils/nm.c b/binutils/nm.c index 69e697a..3501f48 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -421,7 +421,10 @@ print_symname (const char *form, struct extended_symbol_info *info, = bfd_get_symbol_version_string (abfd, &info->elfinfo->symbol, FALSE, &hidden); if (version_string && version_string[0]) - printf ("%s%s", hidden ? "@" : "@@", version_string); + printf ("%s%s", + (hidden || bfd_is_und_section (info->elfinfo->symbol.section) + ? "@" : "@@"), + version_string); } } |