[PATCH] D58048: [llvm-readobj] - Simjplify .gnu.version_r dumping a bit.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 04:43:02 PST 2019
grimar created this revision.
grimar added a reviewer: jhenderson.
Herald added a subscriber: rupprecht.
.gnu.version_r was implemented by me in D21024 <https://reviews.llvm.org/D21024>.
Implementation takes "Number of needed versions" from DT_VERNEEDNUM
dynamic tag entry. Though it would be simpler to take it from sh_info section header field:
https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-94076/index.html
https://reviews.llvm.org/D58048
Files:
tools/llvm-readobj/ELFDumper.cpp
Index: tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- tools/llvm-readobj/ELFDumper.cpp
+++ tools/llvm-readobj/ELFDumper.cpp
@@ -711,19 +711,12 @@
if (!Sec)
return;
- unsigned VerNeedNum = 0;
- for (const typename ELFO::Elf_Dyn &Dyn : Dumper->dynamic_table()) {
- if (Dyn.d_tag == DT_VERNEEDNUM) {
- VerNeedNum = Dyn.d_un.d_val;
- break;
- }
- }
-
const uint8_t *SecData = (const uint8_t *)Obj->base() + Sec->sh_offset;
const typename ELFO::Elf_Shdr *StrTab =
unwrapOrError(Obj->getSection(Sec->sh_link));
const uint8_t *P = SecData;
+ unsigned VerNeedNum = Sec->sh_info;
for (unsigned I = 0; I < VerNeedNum; ++I) {
const VerNeed *Need = reinterpret_cast<const VerNeed *>(P);
DictScope Entry(W, "Dependency");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58048.186233.patch
Type: text/x-patch
Size: 848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190211/e437f938/attachment.bin>
More information about the llvm-commits
mailing list