This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj/ELF] Print GNU Hash section
ClosedPublic

Authored by ikudrin on Oct 13 2015, 7:21 AM.

Details

Summary

Add a new command line switch, -gnu-hash-table, to print the content of that section.

Diff Detail

Repository
rL LLVM

Event Timeline

ikudrin updated this revision to Diff 37247.Oct 13 2015, 7:21 AM
ikudrin retitled this revision from to [llvm-readobj/ELF] Print GNU Hash section.
ikudrin updated this object.
ikudrin added reviewers: rafael, Bigcheese.
ikudrin added a subscriber: llvm-commits.
rafael accepted this revision.Oct 13 2015, 3:58 PM
rafael edited edge metadata.

LGTM with nits.

Thanks for doing this!

include/llvm/Object/ELFTypes.h
498 ↗(On Diff #37247)

This should not be an ArrayRef of uintX_t since that is host endian. You can use Elf_Off.

508 ↗(On Diff #37247)

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.

tools/llvm-readobj/ELFDumper.cpp
1549 ↗(On Diff #37247)

"First hashed symbol index " is probably more descriptive.

1554 ↗(On Diff #37247)

Report an error if we have a hash but not a dynamic symbol table.

This revision is now accepted and ready to land.Oct 13 2015, 3:58 PM

This should not be an ArrayRef of uintX_t since that is host endian. You can use Elf_Off.

Ah, and maybe test that by adding a ppc binary?

Thanks,
Rafael

This revision was automatically updated to reflect the committed changes.
ikudrin marked 4 inline comments as done.Oct 14 2015, 5:31 AM

Thank you for the comments!

Finally fixed in r250292.