Do not show unrelated "-m is missing" error message.
authorRui Ueyama <ruiu@google.com>
Tue, 5 Jun 2018 16:13:40 +0000 (16:13 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 5 Jun 2018 16:13:40 +0000 (16:13 +0000)
Previously, "-m is missing" error message is shown if you pass a
nonexistent file or don't pass any file at all to lld, as shown below:

  $ ld.lld nonexistent.o
  ld.lld: error: cannot open nonexistent.o: No such file or directory
  ld.lld: error: target emulation unknown: -m or at least one .o file required

This patch eliminates the second error message because it's not related
and even inaccurate (you passed a .o file though it didn't exist).

llvm-svn: 334024

lld/ELF/Driver.cpp

index 2e3a425..99d476f 100644 (file)
@@ -382,6 +382,9 @@ void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
   readConfigs(Args);
   initLLVM();
   createFiles(Args);
+  if (errorCount())
+    return;
+
   inferMachineType();
   setConfigs(Args);
   checkOptions(Args);