This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] Make -s and -t match llvm-readelf
ClosedPublic

Authored by MaskRay on Jun 28 2021, 12:39 PM.

Details

Summary

llvm-readobj is an internal testing tool for binary formats. Its output and
command line options do not need to be stable. It isn't supposed to be part of a
build process.

llvm-readelf was created as a user-facing utility and its interface intends to
be compatible with GNU readelf (unless there are good reasons not to).

The two tools have mostly compatible options. -s and -t are noticeable
exceptions due to history. I think the cost of keeping the inconsistency overweighs the
little history-compatible benefit and hinders transition from cl::opt to
OptTable, so let's change it.

Diff Detail

Event Timeline

MaskRay created this revision.Jun 28 2021, 12:39 PM
MaskRay requested review of this revision.Jun 28 2021, 12:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2021, 12:39 PM

Seems fine to me, but can you mention it in the release notes? Even though it's primarily a testing tool, downstream users may use llvm-readobj in their testing.

MaskRay updated this revision to Diff 355040.Jun 28 2021, 2:07 PM

add release notes

jhenderson accepted this revision.Jun 29 2021, 12:45 AM

Seems reasonable to me too. Might be worth an llvm-dev heads-up? Up to you.

llvm/docs/ReleaseNotes.rst
167–168

I think this statement is a little unclear could cause some confusion. How about this: "The llvm-readobj short aliases -s (previously --sections) and -t (previously --syms) have been changed to --syms and --section-details respectively, to match llvm-readelf."

llvm/test/tools/llvm-readobj/ELF/merged.test
55

No need to change this test, I think. You still want -s in the list, and you already have -S there. You might also want to add -t, but it's not really importantn, in my opinion.

This revision is now accepted and ready to land.Jun 29 2021, 12:45 AM
MaskRay updated this revision to Diff 355310.Jun 29 2021, 11:29 AM
MaskRay marked an inline comment as done.

update release notes; update -aeWhSrnudlVgIS

MaskRay edited the summary of this revision. (Show Details)Jun 29 2021, 11:51 AM
MaskRay edited the summary of this revision. (Show Details)
This revision was landed with ongoing or failed builds.Jun 29 2021, 11:56 AM
This revision was automatically updated to reflect the committed changes.
jhenderson added inline comments.Jun 30 2021, 12:07 AM
llvm/test/tools/llvm-readobj/ELF/merged.test
55

You've still got S twice in this list (at the end and immediately after the h).

MaskRay added inline comments.Jun 30 2021, 12:19 PM
llvm/test/tools/llvm-readobj/ELF/merged.test
55

The diagnostic is because --section-headers is specified twice. We need two -S to trigger the previous diagnostic. I'll keep one -s here.

55

Previously both -S and -s were aliases for --section-headers. That was how the diagnostic was triggered.

Keeping two -S can trigger the --section-headers. If I drop one the message will go away.

jhenderson added inline comments.Jul 1 2021, 12:26 AM
llvm/test/tools/llvm-readobj/ELF/merged.test
55

Oh, sorry, misread what the test was doing, thanks!