[PATCH] D78894: [ms] Add new option to llvm-lib: /llvmemptylib

Eric Astor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 26 21:15:11 PDT 2020


epastor created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
epastor added a reviewer: thakis.

Add a new option (/llvmemptylib). If passed and llvm-lib does not give an error, it will create a valid output archive even if empty.

By default, llvm-lib mimicks lib.exe: if given no input files, it doesn't create its output file at all. This is incompatible with some build systems, so we add a command-line option to toggle this compatibility behavior.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78894

Files:
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/lib/ToolDrivers/llvm-lib/Options.td


Index: llvm/lib/ToolDrivers/llvm-lib/Options.td
===================================================================
--- llvm/lib/ToolDrivers/llvm-lib/Options.td
+++ llvm/lib/ToolDrivers/llvm-lib/Options.td
@@ -18,6 +18,9 @@
 def llvmlibthin : F<"llvmlibthin">,
     HelpText<"Make .lib point to .obj files instead of copying their contents">;
 
+def llvmlibempty : F<"llvmlibempty">,
+    HelpText<"When given no contents, produce an empty .lib file">;
+
 def machine: P<"machine", "Specify target platform">;
 
 def help : F<"help">;
Index: llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
===================================================================
--- llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
+++ llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
@@ -292,8 +292,9 @@
     return 0;
   }
 
-  // If no input files, silently do nothing to match lib.exe.
-  if (!Args.hasArgNoClaim(OPT_INPUT))
+  // If no input files and not told otherwise, silently do nothing to match
+  // lib.exe
+  if (!Args.hasArgNoClaim(OPT_INPUT) && !Args.hasArg(OPT_llvmlibempty))
     return 0;
 
   if (Args.hasArg(OPT_lst)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78894.260204.patch
Type: text/x-patch
Size: 1106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200427/ae381602/attachment.bin>


More information about the llvm-commits mailing list