The syntax of llvm-ar's command line arguments is strange to someone who is used to using plain old ar or GNU ar. For instance, you don't get to specify which action it will take; it always creates ('c') archives. See the ar(1) man page for an example of what I am getting at. It would be really nice if llvm-ar took either the same kinds of command line options as other versions of ar, or a subset thereof. Sorry this is so vague; I don't have time to explicitly specify all the things that real ar(1) can do, and the documentation is widely available.
You're certainly right, llvm-ar should be a drop in replacement for the system ar, which happens to do nice things for LLVM bytecode files (generates a symbol table). At this point, llvm-ar is not finished and should not be used, so this is not a high-priority problem.
Created attachment 19 [details] Partial patch Here is a patch which makes llvm-ar accept many common ar options, though the only variable which actually does anything is still SymbolTableOption. I have labeled it as a "partial patch" for the following other reason: ar(1) as described in the Single Unix Specification and in the GNU manual has a syntax for command-line arguments which is, as far as I can tell, unique. It superficially resembles the command-line syntax of dump(8)/restore(8) and tar(1), but it is different in that the argument to the [abi] options must always precede the name of the archive. So although I appreciate the tasty goodness of Chris's CommandLine library, and I briefly considered extending it to support ar(1) argument syntax, I think the right thing to do is *not* to use cl::ParseCommandLineOptions() in this tool, and instead to write a custom command-line argument parser. I'm probably not going to work on this at all for at least another week. Anyone else have any comments?
llvm-ar should now have the proper syntax. Note: llvm-ar is not complete.