This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf] - Simplify the implementation of getSectionTypeString() helper. NFCI.
ClosedPublic

Authored by grimar on Jul 22 2020, 8:27 AM.

Details

Summary

It is used for printing section headers in the GNU style
and the implementation can be simplified.

Diff Detail

Event Timeline

grimar created this revision.Jul 22 2020, 8:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 22 2020, 8:27 AM
jhenderson accepted this revision.Jul 23 2020, 12:26 AM

LGTM.

llvm/tools/llvm-readobj/ELFDumper.cpp
3784–3787

FWIW, I think this clause is a bad design in the original version - a user when dumping the section headers will not be able to distinguish between SHT_RELR and SHT_ANDROID_RELR. They might be identical internally, but the sh_type value is different.

We shouldn't fix it in this patch, but it might be worth reaching out to the original people to implement it to bring this up. What do you think?

This revision is now accepted and ready to land.Jul 23 2020, 12:26 AM
grimar marked an inline comment as done.Jul 23 2020, 2:58 AM
grimar added inline comments.
llvm/tools/llvm-readobj/ELFDumper.cpp
3784–3787

Yeah. The fresh GNU source code (2.34) still doesn't know about SHT_ANDROID_RELR/SHT_RELR,
so seems it should not be a problem to fix it on LLVM side. I`ll prepare a patch.

This revision was automatically updated to reflect the committed changes.