summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorGeorgii Rymar <grimar@accesssoftek.com>2019-11-28 13:20:25 +0300
committerGeorgii Rymar <grimar@accesssoftek.com>2019-11-29 11:09:56 +0300
commit7ab14813619189d13382da047409a81c94ebc58d (patch)
tree18ca65241aa1c402b9ceafc8ef021a6d4c32b57e /llvm/tools
parent06e5ebf8dbd9c19c2ef58e6eee6346de8688bc5b (diff)
downloadbcm5719-llvm-7ab14813619189d13382da047409a81c94ebc58d.tar.gz
bcm5719-llvm-7ab14813619189d13382da047409a81c94ebc58d.zip
[llvm-readelf/llvm-readobj] - Check version of SHT_GNU_verdef section entries when dumping.
Elfxx_Verdef contains the following field: vd_version Version revision. This field shall be set to 1. (https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html) Our code should check the struct version for correctness. This patch does that. (This will help to simplify or eliminate ELFDumper<ELFT>::LoadVersionDefs() which has it's own logic to parse version definitions for no reason. It checks the struct version currently). Differential revision: https://reviews.llvm.org/D70810
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-readobj/ELFDumper.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 79d08d379a1..51ea599f4be 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -409,6 +409,12 @@ ELFDumper<ELFT>::getVersionDefinitions(const Elf_Shdr *Sec) const {
": found a misaligned version definition entry at offset 0x" +
Twine::utohexstr(VerdefBuf - Start));
+ unsigned Version = *reinterpret_cast<const Elf_Half *>(VerdefBuf);
+ if (Version != 1)
+ return createError("unable to dump SHT_GNU_verdef section with index " +
+ Twine(SecNdx) + ": version " + Twine(Version) +
+ " is not yet supported");
+
const Elf_Verdef *D = reinterpret_cast<const Elf_Verdef *>(VerdefBuf);
VerDef &VD = *Ret.emplace(Ret.end());
VD.Offset = VerdefBuf - Start;
OpenPOWER on IntegriCloud