Allow oformat to accept format starting with elf as acceptable format. isOutputFormat...
authorRumeet Dhindsa <rdhindsa@google.com>
Tue, 31 Jul 2018 21:58:26 +0000 (21:58 +0000)
committerRumeet Dhindsa <rdhindsa@google.com>
Tue, 31 Jul 2018 21:58:26 +0000 (21:58 +0000)
Example: --oformat elf64-x86-64

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

llvm-svn: 338445

lld/ELF/Driver.cpp
lld/test/ELF/oformat-binary.s

index 50555fb..693dba6 100644 (file)
@@ -501,6 +501,8 @@ static bool isOutputFormatBinary(opt::InputArgList &Args) {
     StringRef S = Arg->getValue();
     if (S == "binary")
       return true;
+    if (S.startswith("elf"))
+      return false;
     error("unknown --oformat value: " + S);
   }
   return false;
index 44c7b5a..e68f07c 100644 (file)
@@ -19,6 +19,8 @@
 # RUN:   | FileCheck %s --check-prefix ERR
 # ERR: unknown --oformat value: foo
 
+# RUN: ld.lld -o /dev/null %t --oformat elf
+
 .text
 .align 4
 .globl _start