diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-06-14 05:37:19 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-06-14 05:37:33 -0700 |
commit | 1f6f5dba57ffbc073b1ead89647288feaaed2caf (patch) | |
tree | abea3a9c90a1731dbd1cc39843491f6d5e2d7995 /binutils/readelf.c | |
parent | 7b045207d1b8980add1c87b643504e3ef987e7a2 (diff) | |
download | gdb-1f6f5dba57ffbc073b1ead89647288feaaed2caf.zip gdb-1f6f5dba57ffbc073b1ead89647288feaaed2caf.tar.gz gdb-1f6f5dba57ffbc073b1ead89647288feaaed2caf.tar.bz2 |
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.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c index 3af729f..2188b25 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -11266,7 +11266,7 @@ get_symbol_version_string (Filedata * filedata, vers_data = byte_get (data, 2); - if ((vers_data & VERSYM_HIDDEN) == 0 && vers_data <= 1) + if ((vers_data & VERSYM_HIDDEN) == 0 && vers_data == 0) return NULL; /* Usually we'd only see verdef for defined symbols, and verneed for @@ -11301,12 +11301,14 @@ get_symbol_version_string (Filedata * filedata, ivd.vd_ndx = 0; ivd.vd_aux = 0; ivd.vd_next = 0; + ivd.vd_flags = 0; } else { ivd.vd_ndx = BYTE_GET (evd.vd_ndx); ivd.vd_aux = BYTE_GET (evd.vd_aux); ivd.vd_next = BYTE_GET (evd.vd_next); + ivd.vd_flags = BYTE_GET (evd.vd_flags); } off += ivd.vd_next; @@ -11315,6 +11317,9 @@ get_symbol_version_string (Filedata * filedata, if (ivd.vd_ndx == (vers_data & VERSYM_VERSION)) { + if (ivd.vd_ndx == 1 && ivd.vd_flags == VER_FLG_BASE) + return NULL; + off -= ivd.vd_next; off += ivd.vd_aux; |