[PATCH] D70495: [llvm-readobj/llvm-readelf] - Reimplement dumping of the SHT_GNU_verdef section.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 18:43:59 PST 2019


MaskRay added inline comments.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:3943
+
+  const uint8_t *Start = (*ContentsOrErr).data();
+  const uint8_t *End = Start + ContentsOrErr->size();
----------------
`ContentsOrErr->data()`


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:3959
+    Aux.Offset = VerdauxBuf - Start;
+    if (Verdaux->vda_name <= (*StrTabOrErr).size())
+      Aux.Name = (*StrTabOrErr).drop_front(Verdaux->vda_name);
----------------
`->`


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:3968
+  const uint8_t *VerdefBuf = Start;
+  for (unsigned I = 0; I < /*VerDefsNum=*/Sec->sh_info; ++I) {
+    if (VerdefBuf + sizeof(Elf_Verdef) > End)
----------------
Use `for (unsigned I = 1; I <= Sec->sh_info; ++I)` to avoid `I + 1` below.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70495/new/

https://reviews.llvm.org/D70495





More information about the llvm-commits mailing list