[lld] r342158 - lld-link: For nonexisting inputs, omit follow-on diagnostics

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 13 11:13:21 PDT 2018


Author: nico
Date: Thu Sep 13 11:13:21 2018
New Revision: 342158

URL: http://llvm.org/viewvc/llvm-project?rev=342158&view=rev
Log:
lld-link: For nonexisting inputs, omit follow-on diagnostics

For lld-link missing.obj, lld-link currently prints:

  lld-link: error: could not open foo.obj: No such file or directory
  lld-link: warning: /machine is not specified. x64 is assumed
  lld-link: error: subsystem must be defined

The 2nd and 3rd diagnostics are consequences of the input not existing and are
not interesting. If input files are missing, the best thing we can do is point
that out and then return.

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

Added:
    lld/trunk/test/COFF/could-not-open.test
Modified:
    lld/trunk/COFF/Driver.cpp

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=342158&r1=342157&r2=342158&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Thu Sep 13 11:13:21 2018
@@ -1236,6 +1236,9 @@ void LinkerDriver::link(ArrayRef<const c
   // Read all input files given via the command line.
   run();
 
+  if (errorCount())
+    return;
+
   // We should have inferred a machine type by now from the input files, but if
   // not we assume x64.
   if (Config->Machine == IMAGE_FILE_MACHINE_UNKNOWN) {

Added: lld/trunk/test/COFF/could-not-open.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/could-not-open.test?rev=342158&view=auto
==============================================================================
--- lld/trunk/test/COFF/could-not-open.test (added)
+++ lld/trunk/test/COFF/could-not-open.test Thu Sep 13 11:13:21 2018
@@ -0,0 +1,5 @@
+RUN: not lld-link 01 2>&1 | FileCheck %s
+
+CHECK:     could not open 01
+CHECK-NOT: /machine is not specified
+CHECK-NOT: subsystem must be defined




More information about the llvm-commits mailing list