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.
This commit is contained in:
H.J. Lu
2020-08-22 08:31:53 -07:00
parent d19c3068ab
commit 3f2e969923
9 changed files with 68 additions and 5 deletions

View File

@@ -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