[PATCH] D13696: [llvm-readobj/ELF] Print GNU Hash section

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 15:58:03 PDT 2015


rafael accepted this revision.
rafael added a comment.
This revision is now accepted and ready to land.

LGTM with nits.

Thanks for doing this!


================
Comment at: include/llvm/Object/ELFTypes.h:498
@@ +497,3 @@
+
+  ArrayRef<uintX_t> filter() const {
+    return ArrayRef<uintX_t>(reinterpret_cast<const uintX_t *>(&shift2 + 1),
----------------
This should not be an ArrayRef of uintX_t since that is host endian. You can use Elf_Off.

================
Comment at: include/llvm/Object/ELFTypes.h:508
@@ +507,3 @@
+
+  ArrayRef<Elf_Word> chains(unsigned DynamicSymCount) const {
+    return ArrayRef<Elf_Word>(buckets().end(), DynamicSymCount - symndx);
----------------
values maybe?

There is no official spec for the names, but that is what

https://blogs.oracle.com/ali/entry/gnu_hash_elf_sections

uses which I think is the closest thing to a spec.

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:1549
@@ +1548,3 @@
+  W.printNumber("Num Buckets", GnuHashTable->nbuckets);
+  W.printNumber("Symbol Index", GnuHashTable->symndx);
+  W.printNumber("Num Mask Words", GnuHashTable->maskwords);
----------------
"First hashed symbol index " is probably more descriptive.

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:1554
@@ +1553,3 @@
+  W.printList("Buckets", GnuHashTable->buckets());
+  if (!DotDynSymSec)
+    return;
----------------
Report an error if we have a hash but not a dynamic symbol table.


http://reviews.llvm.org/D13696





More information about the llvm-commits mailing list