65 lines
2 KiB
Text
65 lines
2 KiB
Text
|
- add a dummy -t flag to llvm-ranlib to match binutils' ranlib's -t flag which
|
||
|
is a no-op
|
||
|
- support more than one input file in llvm-ranlib
|
||
|
|
||
|
Index: tools/llvm-ar/llvm-ar.cpp
|
||
|
--- tools/llvm-ar/llvm-ar.cpp.orig
|
||
|
+++ 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 <archive-file>
|
||
|
+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<StringRef> Archives;
|
||
|
for (int i = 1; i < argc; ++i) {
|
||
|
StringRef arg(argv[i]);
|
||
|
if (handleGenericOption(arg)) {
|
||
|
@@ -1242,23 +1242,27 @@ static int ranlib_main(int argc, char **argv) {
|
||
|
} else if (arg.front() == 'v') {
|
||
|
cl::PrintVersionMessage();
|
||
|
return 0;
|
||
|
+ } else if (arg.front() == 't') {
|
||
|
+ // GNU ranlib also supports a -t flag, but does nothing
|
||
|
+ // because it just returns true without touching the
|
||
|
+ // timestamp, so simulate the same behaviour.
|
||
|
+ return 0;
|
||
|
} else {
|
||
|
- // TODO: GNU ranlib also supports a -t flag
|
||
|
fail("Invalid option: '-" + 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) {
|