Print only undefined symbols.
-.. option:: --version
+.. option:: --version, -V
- Display the version of the :program:`llvm-nm` executable. Does not stack with
- other commands.
+ Display the version of the :program:`llvm-nm` executable, then exit. Does not
+ stack with other commands.
.. option:: --without-aliases
--- /dev/null
+# Check that the output of llvm-nm -V (and --version) contains the text
+# "GNU" somewhere, to let libtool know that it is compatible with GNU nm.
+# Also check that it contains the LLVM version.
+
+RUN: llvm-nm -V | FileCheck %s
+RUN: llvm-nm --version | FileCheck %s
+CHECK: LLVM version
+CHECK: GNU
"TBD(Mach-O) only"),
cl::cat(NMCat));
+cl::opt<bool> Version("V", cl::desc("Print version info"), cl::cat(NMCat));
+
cl::extrahelp HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
bool PrintAddress = true;
}
}
+static void printExtraVersionInfo(raw_ostream &Outs) {
+ // This needs to contain the word "GNU", libtool looks for that string.
+ Outs << "llvm-nm, compatible with GNU nm\n";
+}
+
int main(int argc, char **argv) {
InitLLVM X(argc, argv);
cl::HideUnrelatedOptions(NMCat);
+ cl::AddExtraVersionPrinter(printExtraVersionInfo);
cl::ParseCommandLineOptions(argc, argv, "llvm symbol table dumper\n");
+ if (Version) {
+ cl::PrintVersionMessage();
+ printExtraVersionInfo(outs());
+ return 0;
+ }
+
// llvm-nm only reads binary files.
if (error(sys::ChangeStdinToBinary()))
return 1;