This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf] --section-details: display SHF_COMPRESSED headers
ClosedPublic

Authored by MaskRay on Oct 24 2022, 1:37 PM.

Details

Summary

readelf --section-details displays ch_type/ch_size/ch_addralign for
a SHF_COMPRESSED section. Port the feature. There is a small difference
that readelf doesn't display [<corrupt>] for an empty section while
we do.

Diff Detail

Event Timeline

MaskRay created this revision.Oct 24 2022, 1:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 1:37 PM
MaskRay requested review of this revision.Oct 24 2022, 1:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2022, 1:37 PM
jhenderson added inline comments.Oct 25 2022, 2:46 AM
llvm/tools/llvm-readobj/ELFDumper.cpp
4196

I'm wondering if we should report this error as a warning. It might help the user know why their section is corrupt, for example.

MaskRay added inline comments.Oct 25 2022, 10:16 AM
llvm/tools/llvm-readobj/ELFDumper.cpp
4196

The GNU behavior is [<corrupt>]. Do you suggest a separate warning beside the stdout output? That may duplicate the information...

jhenderson added inline comments.Oct 26 2022, 12:25 AM
llvm/tools/llvm-readobj/ELFDumper.cpp
4196

Yes, that's what I'm suggesting. For example, we already have in llvm-readelf warnings when the code can't read a section name, but we still print a placeholder for the name (e.g. <no-strings> in https://github.com/llvm/llvm-project/blob/main/llvm/test/tools/llvm-readobj/ELF/sections-no-section-header-string-table.test).

MaskRay updated this revision to Diff 470853.Oct 26 2022, 10:13 AM

add a warning

MaskRay marked 2 inline comments as done.Oct 26 2022, 10:13 AM
This revision is now accepted and ready to land.Oct 27 2022, 1:14 AM