[llvm-dev] RFC: llvm-readelf Mach-O & COFF options

James Henderson via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 1 02:55:38 PDT 2019


Hi Alex,

It's worth noting that the "alias" nature is really an implementation
detail of the tools. There is nothing stopping us within the build process
producing a completely separate executable (indeed, I think, though I'm not
certain, that essentially this is what happens on Windows). Some tools
(e.g. llvm-strip and llvm-objcopy) intentionally have a different set of
options, and indeed the other options aren't even available.

I personally am against having "hidden" options documented in either form.
They should be either hidden in all forms or nowhere (except possibly
--help-hidden). Hidden options should, in my opinion, be limited to a)
options that are irrelevant to the tool, b) options that are experimental
and not ready for use, or c) options intended only for those in the know
about how to use them. I'd argue that the llvm-readelf Mach-O/COFF options
fall under a), since llvm-readelf is intended to be a GNU readelf
equivalent, which doesn't support these switches, and they don't have any
use for ELF objects. Users who wish to dump Mach-O and COFF output should
be using llvm-readobj. Additionally, as noted in my original email, many
people will be migrating from GNU readelf to llvm-readelf, and may find the
large number of extra switches irrelevant, making it harder to interpret
the help output.

James

On Sat, 29 Jun 2019 at 07:28, Alex Brachet-Mialot <
alexbrachetmialot at gmail.com> wrote:

> My personal preference is that llvm-readelf only show the elf related
> options with -help and show all with -help-hidden. There is support for
> this in CommandLine.h, but I don't know how tricky it gets when we don't
> want them to be hidden for llvm-readobj. I haven't looked into this fully.
>
> For some reference, I have compiled how the other alias tools are handled.
> Many of these are aliases to llvm-ar, it is helpful to know that llvm-ar
> doesn't use CommandLine.h to parse its options.
>
> llvm-addr2line -> llvm-symbolizer: help is the same, docs mention it is an
> alias and only note the differences between it and llvm-symbolizer.
> llvm-dlltool -> llvm-ar: help is different and -help-hidden changes
> nothing. I couldn't find docs for llvm-dlltool.
> llvm-lib -> llvm-ar: *no* help option for llvm-lib. The docs don't even
> have a see also for ar.
> llvm-ranlib -> llvm-ar: help is different. Docs mention it is an alias and
> note the differences.
> llvm-strip -> llvm-objcopy: help is slightly different. Docs do not
> mention it is an alias.
>
> The lack of a pattern makes some sense given different tools will have
> different requirements. Perhaps a useless widening of the scope of your
> question then. But back to your question, I personally think that a man
> page has the room to include _hidden_ options and don't see any benefit in
> excluding them. I also think it makes sense to mention it is an alias in
> the man page because it is a little curious otherwise why something called
> readelf has so many options for non elf files, in my opinion.
>
> Best,
> Alex
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190701/5b11ea84/attachment.html>


More information about the llvm-dev mailing list