[PATCH] D104527: [LLD] [MinGW] Print the lld-link command to stderr if running with -verbose

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 18 05:36:56 PDT 2021


mstorsjo created this revision.
mstorsjo added a reviewer: rnk.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

When testing with -###, we print the output to stdout, as that's the
main purpose of the link command (as it exits after printing).

When linking with -verbose, we continue and then get log messages
from the actual link. Those log messages are printed to stderr. By
printing the command to the same stream, we make sure they appear
in a sensible chronological order.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104527

Files:
  lld/MinGW/Driver.cpp


Index: lld/MinGW/Driver.cpp
===================================================================
--- lld/MinGW/Driver.cpp
+++ lld/MinGW/Driver.cpp
@@ -427,7 +427,10 @@
     return false;
 
   if (args.hasArg(OPT_verbose) || args.hasArg(OPT__HASH_HASH_HASH))
-    lld::outs() << llvm::join(linkArgs, " ") << "\n";
+    // Print to stdout if testing with -###, otherwise to stderr like other
+    // regular logging.
+    (args.hasArg(OPT__HASH_HASH_HASH) ? lld::outs() : lld::errs())
+        << llvm::join(linkArgs, " ") << "\n";
 
   if (args.hasArg(OPT__HASH_HASH_HASH))
     return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104527.352983.patch
Type: text/x-patch
Size: 590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210618/3c37b398/attachment.bin>


More information about the llvm-commits mailing list