From: robert Date: Tue, 13 Sep 2022 09:57:09 +0000 (+0000) Subject: support more than one input file in llvm-ranlib by backporting X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ffcfe41759859a93b996d2ce3eae0583fa35d1c1;p=openbsd support more than one input file in llvm-ranlib by backporting commit aa173573198e024b065c5f6523ce26bb865781b7 from upstream ok kettenis@ --- diff --git a/gnu/llvm/llvm/tools/llvm-ar/llvm-ar.cpp b/gnu/llvm/llvm/tools/llvm-ar/llvm-ar.cpp index c2e553d9934..f9c8b8baf91 100644 --- a/gnu/llvm/llvm/tools/llvm-ar/llvm-ar.cpp +++ b/gnu/llvm/llvm/tools/llvm-ar/llvm-ar.cpp @@ -63,9 +63,9 @@ static StringRef Stem; 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 +USAGE: llvm-ranlib archive... OPTIONS: -h --help - Display available options @@ -1224,7 +1224,7 @@ static int ar_main(int argc, char **argv) { } static int ranlib_main(int argc, char **argv) { - bool ArchiveSpecified = false; + std::vector Archives; for (int i = 1; i < argc; ++i) { StringRef arg(argv[i]); if (handleGenericOption(arg)) { @@ -1253,16 +1253,16 @@ static int ranlib_main(int argc, char **argv) { 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) { diff --git a/gnu/usr.bin/clang/llvm-ar/ranlib.1 b/gnu/usr.bin/clang/llvm-ar/ranlib.1 index 6a287b7b28e..9b5cb749f0d 100644 --- a/gnu/usr.bin/clang/llvm-ar/ranlib.1 +++ b/gnu/usr.bin/clang/llvm-ar/ranlib.1 @@ -32,11 +32,11 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .. .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\&.