[llvm] r344222 - [llvm-nm] Include the text "@FILE" in the output of --help

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 10 23:53:38 PDT 2018


Author: mstorsjo
Date: Wed Oct 10 23:53:38 2018
New Revision: 344222

URL: http://llvm.org/viewvc/llvm-project?rev=344222&view=rev
Log:
[llvm-nm] Include the text "@FILE" in the output of --help

libtool requires this text to be present, in order to conclude that
the tool supports response files. Also add an explicit test of using
response files with llvm-nm.

Differential Revision: https://reviews.llvm.org/D53064

Added:
    llvm/trunk/test/tools/llvm-nm/X86/response-file.test
    llvm/trunk/test/tools/llvm-nm/libtool-response-file.test
Modified:
    llvm/trunk/tools/llvm-nm/llvm-nm.cpp

Added: llvm/trunk/test/tools/llvm-nm/X86/response-file.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-nm/X86/response-file.test?rev=344222&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-nm/X86/response-file.test (added)
+++ llvm/trunk/test/tools/llvm-nm/X86/response-file.test Wed Oct 10 23:53:38 2018
@@ -0,0 +1,5 @@
+# RUN: echo "-P %p/Inputs/hello.obj.elf-x86_64" > %t-response
+# RUN: llvm-nm @%t-response | FileCheck %s
+
+CHECK: main T 0 0
+CHECK: puts U 0 0

Added: llvm/trunk/test/tools/llvm-nm/libtool-response-file.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-nm/libtool-response-file.test?rev=344222&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-nm/libtool-response-file.test (added)
+++ llvm/trunk/test/tools/llvm-nm/libtool-response-file.test Wed Oct 10 23:53:38 2018
@@ -0,0 +1,4 @@
+RUN: llvm-nm --help | FileCheck %s
+Check that the output of llvm-nm --help contains the literal text @FILE; this
+indicates to libtool that llvm-nm does support response files.
+CHECK: @FILE

Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=344222&r1=344221&r2=344222&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Wed Oct 10 23:53:38 2018
@@ -183,6 +183,8 @@ cl::opt<bool> DyldInfoOnly("dyldinfo-onl
 cl::opt<bool> NoLLVMBitcode("no-llvm-bc",
                             cl::desc("Disable LLVM bitcode reader"));
 
+cl::extrahelp HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
+
 bool PrintAddress = true;
 
 bool MultipleFiles = false;




More information about the llvm-commits mailing list