summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/ELFDumper.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-02-18 13:58:12 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-02-18 13:58:12 +0000
commitd4cfda534c74f67e0095ed2ec56d5e311ef3eda2 (patch)
treee84c44e7001685ee93afa6d37c6191172f09ef4d /llvm/tools/llvm-readobj/ELFDumper.cpp
parentb355802910dab1db05b4aaaf7673e4a021891a95 (diff)
downloadbcm5719-llvm-d4cfda534c74f67e0095ed2ec56d5e311ef3eda2.tar.gz
bcm5719-llvm-d4cfda534c74f67e0095ed2ec56d5e311ef3eda2.zip
[llvm-readobj] - Simplify .gnu.version_d dumping.
This is similar to D58048. Instead of scanning the dynamic table to read the DT_VERDEFNUM, we could take it from the sh_info field. (https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-94076/index.html) The patch does this. llvm-svn: 354270
Diffstat (limited to 'llvm/tools/llvm-readobj/ELFDumper.cpp')
-rw-r--r--llvm/tools/llvm-readobj/ELFDumper.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index dc6e44819aa..9a0d909120d 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -652,16 +652,6 @@ static void printVersionDefinitionSection(ELFDumper<ELFT> *Dumper,
if (!Sec)
return;
- // The number of entries in the section SHT_GNU_verdef
- // is determined by DT_VERDEFNUM tag.
- unsigned VerDefsNum = 0;
- for (const typename ELFO::Elf_Dyn &Dyn : Dumper->dynamic_table()) {
- if (Dyn.d_tag == DT_VERDEFNUM) {
- VerDefsNum = Dyn.d_un.d_val;
- break;
- }
- }
-
const uint8_t *SecStartAddress =
(const uint8_t *)Obj->base() + Sec->sh_offset;
const uint8_t *SecEndAddress = SecStartAddress + Sec->sh_size;
@@ -669,6 +659,7 @@ static void printVersionDefinitionSection(ELFDumper<ELFT> *Dumper,
const typename ELFO::Elf_Shdr *StrTab =
unwrapOrError(Obj->getSection(Sec->sh_link));
+ unsigned VerDefsNum = Sec->sh_info;
while (VerDefsNum--) {
if (P + sizeof(VerDef) > SecEndAddress)
report_fatal_error("invalid offset in the section");
OpenPOWER on IntegriCloud