[PATCH] D59877: [llvm-readobj] Add GNU style dumper for .gnu.version section

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 28 03:24:57 PDT 2019


jhenderson requested changes to this revision.
jhenderson added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:3370
   StringRef SecName = unwrapOrError(Obj->getSectionName(Sec));
-  OS << "Dumper for " << SecName << " is not implemented\n";
+  uint32_t Entries = Sec->sh_size / sizeof(Elf_Versym);
+  OS << "Version symbols section '" << SecName << "' "
----------------
Use `uint64_t` (or possibly size_t) here. ELF64 sections have section sizes of 64-bits.

Various variables below will similarly need adjusting.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:3385
+
+  // readelf prints 4 entries per line.
+  for (uint32_t VersymRow = 0; VersymRow < Entries; VersymRow += 4) {
----------------
Does this behaviour hold if using --wide in GNU readelf?


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:3403
+        OS << format("%4x%c", Versym->vs_index & VERSYM_VERSION,
+                     Versym->vs_index & VERSYM_HIDDEN ? 'h' : ' ');
+
----------------
Test case for hidden symbols?


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:3413
+          VersionName = "(*invalid*)";
+        OS << left_justify(VersionName, 13);
+      }
----------------
What happens if the version name is longer than this? (Is that even possible?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59877





More information about the llvm-commits mailing list