[llvm] r364036 - [binutils] Add response file option to help and docs
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 04:49:20 PDT 2019
Author: jhenderson
Date: Fri Jun 21 04:49:20 2019
New Revision: 364036
URL: http://llvm.org/viewvc/llvm-project?rev=364036&view=rev
Log:
[binutils] Add response file option to help and docs
Many LLVM-based tools already support response files (i.e. files
containing a list of options, specified with '@'). This change simply
updates the documentation and help text for some of these tools to
include it. I haven't attempted to fix all tools, just a selection that
I am interested in.
I've taken the opportunity to add some tests for --help behaviour, where
they were missing. We could expand these tests, but I don't think that's
within scope of this patch.
This fixes https://bugs.llvm.org/show_bug.cgi?id=42233 and
https://bugs.llvm.org/show_bug.cgi?id=42236.
Reviewed by: grimar, MaskRay, jkorous
Differential Revision: https://reviews.llvm.org/D63597
Added:
llvm/trunk/test/tools/llvm-cxxfilt/help.test
llvm/trunk/test/tools/llvm-objdump/help.test
llvm/trunk/test/tools/llvm-size/help.test
llvm/trunk/test/tools/llvm-strings/help.test
Modified:
llvm/trunk/docs/CommandGuide/llvm-nm.rst
llvm/trunk/docs/CommandGuide/llvm-objdump.rst
llvm/trunk/docs/CommandGuide/llvm-readobj.rst
llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test
llvm/trunk/test/tools/llvm-readobj/basic.test
llvm/trunk/test/tools/llvm-symbolizer/help.test
llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
llvm/trunk/tools/llvm-size/llvm-size.cpp
llvm/trunk/tools/llvm-strings/llvm-strings.cpp
llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
Modified: llvm/trunk/docs/CommandGuide/llvm-nm.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-nm.rst?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-nm.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-nm.rst Fri Jun 21 04:49:20 2019
@@ -136,6 +136,10 @@ OPTIONS
Specify the radix of the symbol address(es). Values accepted d(decimal),
x(hexadecimal) and o(octal).
+.. option:: @<FILE>
+
+ Read command-line options from response file `<FILE>`.
+
BUGS
----
Modified: llvm/trunk/docs/CommandGuide/llvm-objdump.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-objdump.rst?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-objdump.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-objdump.rst Fri Jun 21 04:49:20 2019
@@ -316,6 +316,10 @@ MACH-O ONLY OPTIONS AND COMMANDS
Display weak binding information.
+.. option:: @<FILE>
+
+ Read command-line options and commands from response file `<FILE>`.
+
BUGS
----
Modified: llvm/trunk/docs/CommandGuide/llvm-readobj.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-readobj.rst?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-readobj.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-readobj.rst Fri Jun 21 04:49:20 2019
@@ -88,6 +88,10 @@ input. Otherwise, it will read from the
Print demangled symbol names in the output.
+.. option:: @<FILE>
+
+ Read command-line options from response file `<FILE>`.
+
EXIT STATUS
-----------
Modified: llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-symbolizer.rst Fri Jun 21 04:49:20 2019
@@ -169,6 +169,10 @@ OPTIONS
inc at /tmp/x.c:3
main at /tmp/x.c:14
+.. option:: @<FILE>
+
+ Read command-line options from response file `<FILE>`.
+
EXIT STATUS
-----------
Added: llvm/trunk/test/tools/llvm-cxxfilt/help.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cxxfilt/help.test?rev=364036&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-cxxfilt/help.test (added)
+++ llvm/trunk/test/tools/llvm-cxxfilt/help.test Fri Jun 21 04:49:20 2019
@@ -0,0 +1,7 @@
+RUN: llvm-cxxfilt -h | FileCheck %s
+RUN: llvm-cxxfilt --help | FileCheck %s
+
+CHECK: OVERVIEW: llvm symbol undecoration tool
+CHECK: USAGE: llvm-cxxfilt{{(.exe)?}} [options] <mangled>{{$}}
+CHECK: OPTIONS:
+CHECK: @FILE
Modified: llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/cmdline.test Fri Jun 21 04:49:20 2019
@@ -25,6 +25,7 @@ HELP: -show-form
HELP: -show-parents
HELP: -statistics
HELP: -summarize-types
+HELP: @FILE
RUN: llvm-dwarfdump --version 2>&1 | FileCheck --check-prefix=VERSION %s
VERSION: {{ version }}
Added: llvm/trunk/test/tools/llvm-objdump/help.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/help.test?rev=364036&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/help.test (added)
+++ llvm/trunk/test/tools/llvm-objdump/help.test Fri Jun 21 04:49:20 2019
@@ -0,0 +1,6 @@
+RUN: llvm-objdump --help | FileCheck %s
+
+CHECK: OVERVIEW: llvm object file dumper
+CHECK: USAGE: llvm-objdump{{(.exe)?}} [options] <input object files>{{$}}
+CHECK: OPTIONS:
+CHECK: @FILE
Modified: llvm/trunk/test/tools/llvm-readobj/basic.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/basic.test?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/basic.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/basic.test Fri Jun 21 04:49:20 2019
@@ -33,8 +33,14 @@ RUN: llvm-readelf --version | FileCheck
VERSION: version
# Test help switch.
-RUN: llvm-readobj --help | FileCheck %s --check-prefixes=HELP,USAGE-OBJ
-RUN: llvm-readelf --help | FileCheck %s --check-prefixes=HELP,USAGE-ELF
+RUN: llvm-readobj --help | FileCheck %s --check-prefixes=HELP,OBJ
+RUN: llvm-readelf --help | FileCheck %s --check-prefixes=HELP,ELF
HELP: OVERVIEW: LLVM Object Reader
-USAGE-OBJ: llvm-readobj{{.*}} [options] <input object files>
-USAGE-ELF: llvm-readelf{{.*}} [options] <input object files>
+OBJ: llvm-readobj{{.*}} [options] <input object files>
+ELF: llvm-readelf{{.*}} [options] <input object files>
+HELP: OPTIONS:
+OBJ: -s - Alias for --section-headers
+OBJ: -t - Alias for --symbols
+ELF: -s - Alias for --symbols
+ELF-NOT: {{ }}-t{{ }}
+HELP: @FILE
Added: llvm/trunk/test/tools/llvm-size/help.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-size/help.test?rev=364036&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-size/help.test (added)
+++ llvm/trunk/test/tools/llvm-size/help.test Fri Jun 21 04:49:20 2019
@@ -0,0 +1,7 @@
+RUN: llvm-size -h | FileCheck %s
+RUN: llvm-size --help | FileCheck %s
+
+CHECK: OVERVIEW: llvm object size dumper
+CHECK: USAGE: llvm-size{{(.exe)?}} [options] <input files>{{$}}
+CHECK: OPTIONS:
+CHECK: @FILE
Added: llvm/trunk/test/tools/llvm-strings/help.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-strings/help.test?rev=364036&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-strings/help.test (added)
+++ llvm/trunk/test/tools/llvm-strings/help.test Fri Jun 21 04:49:20 2019
@@ -0,0 +1,7 @@
+RUN: llvm-strings -h | FileCheck %s
+RUN: llvm-strings --help | FileCheck %s
+
+CHECK: OVERVIEW: llvm string dumper
+CHECK: USAGE: llvm-strings{{(.exe)?}} [options] <input object files>{{$}}
+CHECK: OPTIONS:
+CHECK: @FILE
Modified: llvm/trunk/test/tools/llvm-symbolizer/help.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-symbolizer/help.test?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-symbolizer/help.test (original)
+++ llvm/trunk/test/tools/llvm-symbolizer/help.test Fri Jun 21 04:49:20 2019
@@ -1,8 +1,12 @@
-RUN: llvm-symbolizer -help | FileCheck %s --check-prefix=SYMBOLIZER
-RUN: llvm-addr2line -help | FileCheck %s --check-prefix=ADDR2LINE
+RUN: llvm-symbolizer -h | FileCheck %s --check-prefix=SYMBOLIZER
+RUN: llvm-symbolizer --help | FileCheck %s --check-prefix=SYMBOLIZER
+RUN: llvm-addr2line -h | FileCheck %s --check-prefix=ADDR2LINE
+RUN: llvm-addr2line --help | FileCheck %s --check-prefix=ADDR2LINE
SYMBOLIZER: OVERVIEW: llvm-symbolizer
SYMBOLIZER: USAGE: llvm-symbolizer{{(.exe)?}} [options] <input addresses>...
+SYMBOLIZER: @FILE
ADDR2LINE: OVERVIEW: llvm-addr2line
ADDR2LINE: USAGE: llvm-addr2line{{(.exe)?}} [options] <input addresses>...
+ADDR2LINE: @FILE
Modified: llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp (original)
+++ llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp Fri Jun 21 04:49:20 2019
@@ -52,6 +52,9 @@ static cl::alias TypesShort("t", cl::des
static cl::list<std::string>
Decorated(cl::Positional, cl::desc("<mangled>"), cl::ZeroOrMore);
+static cl::extrahelp
+ HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
+
static std::string demangle(llvm::raw_ostream &OS, const std::string &Mangled) {
int Status;
Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)
+++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Fri Jun 21 04:49:20 2019
@@ -220,6 +220,8 @@ static opt<bool> Verbose("verbose",
cat(DwarfDumpCategory));
static alias VerboseAlias("v", desc("Alias for -verbose."), aliasopt(Verbose),
cat(DwarfDumpCategory));
+static cl::extrahelp
+ HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
} // namespace
/// @}
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Fri Jun 21 04:49:20 2019
@@ -330,6 +330,9 @@ static cl::opt<bool>
cl::cat(ObjdumpCat));
static cl::alias WideShort("w", cl::Grouping, cl::aliasopt(Wide));
+static cl::extrahelp
+ HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
+
static StringSet<> DisasmFuncsSet;
static StringRef ToolName;
Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Fri Jun 21 04:49:20 2019
@@ -363,6 +363,9 @@ namespace opts {
cl::values(clEnumVal(LLVM, "LLVM default style"),
clEnumVal(GNU, "GNU readelf style")),
cl::init(LLVM));
+
+ cl::extrahelp
+ HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
} // namespace opts
namespace llvm {
Modified: llvm/trunk/tools/llvm-size/llvm-size.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-size/llvm-size.cpp?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-size/llvm-size.cpp (original)
+++ llvm/trunk/tools/llvm-size/llvm-size.cpp Fri Jun 21 04:49:20 2019
@@ -99,6 +99,9 @@ static cl::alias TotalSizesShort("t", cl
static cl::list<std::string>
InputFilenames(cl::Positional, cl::desc("<input files>"), cl::ZeroOrMore);
+static cl::extrahelp
+ HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
+
static bool HadError = false;
static std::string ToolName;
Modified: llvm/trunk/tools/llvm-strings/llvm-strings.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-strings/llvm-strings.cpp?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-strings/llvm-strings.cpp (original)
+++ llvm/trunk/tools/llvm-strings/llvm-strings.cpp Fri Jun 21 04:49:20 2019
@@ -54,6 +54,9 @@ static cl::opt<radix>
cl::init(none));
static cl::alias RadixShort("t", cl::desc(""), cl::aliasopt(Radix));
+static cl::extrahelp
+ HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
+
static void strings(raw_ostream &OS, StringRef FileName, StringRef Contents) {
auto print = [&OS, FileName](unsigned Offset, StringRef L) {
if (L.size() < static_cast<size_t>(MinLength))
Modified: llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp?rev=364036&r1=364035&r2=364036&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp (original)
+++ llvm/trunk/tools/llvm-symbolizer/llvm-symbolizer.cpp Fri Jun 21 04:49:20 2019
@@ -154,6 +154,9 @@ static cl::opt<DIPrinter::OutputStyle>
clEnumValN(DIPrinter::OutputStyle::GNU, "GNU",
"GNU addr2line style")));
+static cl::extrahelp
+ HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
+
template<typename T>
static bool error(Expected<T> &ResOrErr) {
if (ResOrErr)
More information about the llvm-commits
mailing list