[lld] r338647 - Re-submit r338596 with a bug fix and a test.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 1 15:31:31 PDT 2018


Author: ruiu
Date: Wed Aug  1 15:31:31 2018
New Revision: 338647

URL: http://llvm.org/viewvc/llvm-project?rev=338647&view=rev
Log:
Re-submit r338596 with a bug fix and a test.

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/test/ELF/oformat-binary.s

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=338647&r1=338646&r2=338647&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Aug  1 15:31:31 2018
@@ -497,14 +497,11 @@ static Target2Policy getTarget2(opt::Inp
 }
 
 static bool isOutputFormatBinary(opt::InputArgList &Args) {
-  if (auto *Arg = Args.getLastArg(OPT_oformat)) {
-    StringRef S = Arg->getValue();
-    if (S == "binary")
-      return true;
-    if (S.startswith("elf"))
-      return false;
+  StringRef S = Args.getLastArgValue(OPT_oformat, "elf");
+  if (S == "binary")
+    return true;
+  if (!S.startswith("elf"))
     error("unknown --oformat value: " + S);
-  }
   return false;
 }
 

Modified: lld/trunk/test/ELF/oformat-binary.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/oformat-binary.s?rev=338647&r1=338646&r2=338647&view=diff
==============================================================================
--- lld/trunk/test/ELF/oformat-binary.s (original)
+++ lld/trunk/test/ELF/oformat-binary.s Wed Aug  1 15:31:31 2018
@@ -20,6 +20,7 @@
 # ERR: unknown --oformat value: foo
 
 # RUN: ld.lld -o /dev/null %t --oformat elf
+# RUN: ld.lld -o /dev/null %t --oformat elf-foo
 
 .text
 .align 4




More information about the llvm-commits mailing list