[llvm-dev] Supporting sub commands in LLVM command line tools

Renato Golin via llvm-dev
Sat, 18 Jun 2016 11:01:57 -0000

On 18 June 2016 at 02:58, Mehdi Amini via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I haven't looked at the implementation, but conceptually this looks
nice!

Indeed, really nice!


> We talked internally about an option to build something like a single
"llvm"
> binary that would be symlinked by opt/llc/etc. So that when you invoke
> `opt`, it would run the same binary but internally the right subcommand set
> of options would be used. The downside is that running `ninja llvm-mc`
would
> depends on every LLVM libraries though.

I think this would muddle things, but it would also help merge all
command line options (ex. -mtriple vs. -triple vs -target).

The only way I know we could solve the dependency, though, is if there
was a binary called "llvm-mc" from "llvm-mc.cpp" which
provided its
own view of the "llvm-mc" functionality (ie. just a shell), and
"llvm"
would be also just a shell to all of them together.

So, "ninja llvm" would build all tools, while "ninja
llvm-mc" would
only build one of them. Now, how do you then transform from a binary
called "llvm-mc" to a symlink to "llvm", it'd probably
happen at
install time if you choose to install "developer tools", which I find
quite useful from say, an "llvm-dev" package.


> This is a bit orthogonal to what you’re doing, but I assume your patch
would
> help to build such an option right?

Unless you're proposing to move from "llvm-mv" to "llvm
mc", I don't
see how this could...

cheers,
--renato