This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] - Split the printGnuHashTable(). NFCI.
ClosedPublic

Authored by grimar on Jun 16 2020, 4:46 AM.

Details

Summary

printGnuHashTable contains the code to check the GNU hash table.
This patch splits it to getGnuHashTableChains helper (and reorders slightly to reduce).

I am planning to reuse it from the printGnuHashHistogram() for
the same purpose.

Also there is a one possible crash issue in this code,
that needs adding a bit more code to it to fix (i.e. it is better to
split it out as it is becoming large).

Diff Detail

Event Timeline

grimar created this revision.Jun 16 2020, 4:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2020, 4:46 AM
Herald added a subscriber: rupprecht. · View Herald Transcript
grimar edited the summary of this revision. (Show Details)Jun 16 2020, 4:50 AM
jhenderson added inline comments.Jun 17 2020, 12:40 AM
llvm/tools/llvm-readobj/ELFDumper.cpp
2745

Does the change to return an empty array in D81937 actually belong here? I'm a little confused why we seem to be introducing a function that is known to be broken from the outset, only to fix it immediately, rather than just doing it right straight up.

2785

Does it make sense to change this to reportUniqueWarning whilst you're here?

grimar marked 2 inline comments as done.Jun 17 2020, 1:19 AM
grimar added inline comments.
llvm/tools/llvm-readobj/ELFDumper.cpp
2745

I just want to keep this patch NFC, It opens road for other patches (D81937 is only one of them). And to fix this place, we need a test case. This is what D81937 does, it adds a test case and fixes another one. I think it deserves to be an independent change.

2785

I can do this. It seems to be a no-op change,

grimar updated this revision to Diff 271308.Jun 17 2020, 2:29 AM
  • Use reportUniqueWarning.
grimar marked an inline comment as done.Jun 17 2020, 2:32 AM
grimar added inline comments.
llvm/tools/llvm-readobj/ELFDumper.cpp
2745

In fact, D81937 does not need this piece of code to be splitted out to fix the issue it fixes.

This revision is now accepted and ready to land.Jun 17 2020, 3:16 AM
This revision was automatically updated to reflect the committed changes.