[lld] r338445 - Allow oformat to accept format starting with elf as acceptable format. isOutputFormatBinary returns false in such case.

Rumeet Dhindsa via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 14:58:26 PDT 2018


Author: rdhindsa
Date: Tue Jul 31 14:58:26 2018
New Revision: 338445

URL: http://llvm.org/viewvc/llvm-project?rev=338445&view=rev
Log:
Allow oformat to accept format starting with elf as acceptable format. isOutputFormatBinary returns false in such case.

Example: --oformat elf64-x86-64

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


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=338445&r1=338444&r2=338445&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Jul 31 14:58:26 2018
@@ -501,6 +501,8 @@ static bool isOutputFormatBinary(opt::In
     StringRef S = Arg->getValue();
     if (S == "binary")
       return true;
+    if (S.startswith("elf"))
+      return false;
     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=338445&r1=338444&r2=338445&view=diff
==============================================================================
--- lld/trunk/test/ELF/oformat-binary.s (original)
+++ lld/trunk/test/ELF/oformat-binary.s Tue Jul 31 14:58:26 2018
@@ -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




More information about the llvm-commits mailing list