Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -501,6 +501,8 @@ StringRef S = Arg->getValue(); if (S == "binary") return true; + if (S.startswith("elf")) + return false; error("unknown --oformat value: " + S); } return false; Index: test/ELF/oformat-binary.s =================================================================== --- test/ELF/oformat-binary.s +++ test/ELF/oformat-binary.s @@ -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