const char RanlibHelp[] = R"(OVERVIEW: LLVM Ranlib (llvm-ranlib)
- This program generates an index to speed access to archives
+ Generate an index for archives
-USAGE: llvm-ranlib <archive-file>
+USAGE: llvm-ranlib archive...
OPTIONS:
-h --help - Display available options
}
static int ranlib_main(int argc, char **argv) {
- bool ArchiveSpecified = false;
+ std::vector<StringRef> Archives;
for (int i = 1; i < argc; ++i) {
StringRef arg(argv[i]);
if (handleGenericOption(arg)) {
arg = arg.drop_front(1);
}
} else {
- if (ArchiveSpecified)
- fail("exactly one archive should be specified");
- ArchiveSpecified = true;
- ArchiveName = arg.str();
+ Archives.push_back(arg);
}
}
- if (!ArchiveSpecified) {
- badUsage("an archive name must be specified");
+ for (StringRef Archive : Archives) {
+ ArchiveName = Archive.str();
+ performOperation(CreateSymTab, nullptr);
}
- return performOperation(CreateSymTab, nullptr);
+ if (Archives.empty())
+ badUsage("an archive name must be specified");
+ return 0;
}
int main(int argc, char **argv) {
..
.SH SYNOPSIS
.sp
-\fBllvm\-ranlib\fP [\fIoptions\fP]
+\fBllvm\-ranlib\fP [\fIoptions\fP] \fIarchive...\fP
.SH DESCRIPTION
.sp
\fBllvm\-ranlib\fP is an alias for the llvm\-ar tool that
-generates an index for an archive. It can be used as a replacement for GNU\(aqs
+generates an index for one or more archives. It can be used as a replacement for GNU\(aqs
\fBranlib\fP tool.
.sp
Running \fBllvm\-ranlib\fP is equivalent to running \fBllvm\-ar s\fP\&.