stage2: add zig ar subcommand

The same entrypoint supports the following commands:

 * ar
 * ranlib
 * dlltool
 * lib

For now, our strategy is to bundle the (renamed) `main()` function of
llvm-ar, same as our strategy for `zig clang`. However, as Zig matures,
a goal will be to replace the dependency on LLVM  with our own
implementation of this tool, so that it is available in builds of zig
that do not have LLVM extensions enabled.

This commit also categorizes the subcommands into categories in the
--help menu.
This commit is contained in:
Andrew Kelley
2021-05-28 20:54:11 -07:00
parent e248de93a0
commit 0afb5b2ec6
3 changed files with 41 additions and 8 deletions

View File

@@ -1260,7 +1260,8 @@ static int ranlib_main(int argc, char **argv) {
return performOperation(CreateSymTab, nullptr);
}
int main(int argc, char **argv) {
extern "C" int ZigLlvmAr_main(int argc, char **argv);
int ZigLlvmAr_main(int argc, char **argv) {
InitLLVM X(argc, argv);
ToolName = argv[0];