elf: Check if the first symbol version is base version

Check VER_FLG_BASE instead of assuming that the first symbol version is
base version.

bfd/

	PR binutils/23267
	* elf.c (_bfd_elf_get_symbol_version_string): Check if the first
	symbol version is base version.

binutils/

	PR binutils/23267
	* readelf.c (get_symbol_version_string): Check if the first
	symbol version is base version.
This commit is contained in:
H.J. Lu
2018-06-14 05:37:19 -07:00
parent 7b045207d1
commit 1f6f5dba57
4 changed files with 22 additions and 2 deletions

View File

@@ -1865,7 +1865,10 @@ _bfd_elf_get_symbol_version_string (bfd *abfd, asymbol *symbol,
if (vernum == 0)
version_string = "";
else if (vernum == 1)
else if (vernum == 1
&& (vernum > elf_tdata (abfd)->cverdefs
|| (elf_tdata (abfd)->verdef[0].vd_flags
== VER_FLG_BASE)))
version_string = "Base";
else if (vernum <= elf_tdata (abfd)->cverdefs)
version_string =