This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] - Add a test for --hash-table option.
ClosedPublic

Authored by grimar on Jan 21 2020, 7:01 AM.

Details

Summary

We had no test for --hash-table in tools/llvm-readobj.

The one we had was in test/Object and checked that
it is possible to dump the hash table even when an object
doesn't have a section header table.

In this patch I created a test, moved and merged the existent one.
During moving I converted it to be YAML based to stop using the
precompiled binary.

Diff Detail

Event Timeline

grimar created this revision.Jan 21 2020, 7:01 AM
Herald added a project: Restricted Project. · View Herald Transcript
jhenderson added inline comments.Jan 23 2020, 7:59 AM
llvm/test/tools/llvm-readobj/ELF/hash-table.test
92–93

Whilst I see what you're doing here, I think the test would be less confusing if you used llvm-objcopy --strip-sections to remove the section header table. You could then use the same input and checks as the first test case(s).

grimar marked 2 inline comments as done.Jan 24 2020, 2:46 AM
grimar added inline comments.
llvm/test/tools/llvm-readobj/ELF/hash-table.test
92–93

It will not work, because I need a PT_DYNAMIC segment to find .dynamic here. YAMLs above does not have it.
I think we do not want to add it there, as they show we can dump hash table using headers table only.

jhenderson added inline comments.Jan 24 2020, 4:02 AM
llvm/test/tools/llvm-readobj/ELF/hash-table.test
73

Perhaps add a comment saying that we simulate no section header table by overriding the ELF header properties.

92–93

Okay, makes sense.

grimar updated this revision to Diff 240161.Jan 24 2020, 4:18 AM
grimar marked 4 inline comments as done.
  • Addressed review comment.
llvm/test/tools/llvm-readobj/ELF/hash-table.test
73

I've inlined it to the YAML description below.

jhenderson accepted this revision.Jan 24 2020, 4:28 AM

LGTM.

llvm/test/tools/llvm-readobj/ELF/hash-table.test
94–95

Perhaps change 0x0 -> 0 (or vice versa) for consistency/readability. Not a big issue though, if you prefer as is.

This revision is now accepted and ready to land.Jan 24 2020, 4:28 AM
This revision was automatically updated to reflect the committed changes.
grimar marked an inline comment as done.