diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 2b9de7e28873..b1802111eaf2 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -384,7 +384,7 @@ void ScriptParser::readOutputArch() { } std::pair ScriptParser::readBfdName() { - StringRef S = next(); + StringRef S = unquote(next()); if (S == "elf32-i386") return {ELF32LEKind, EM_386}; if (S == "elf32-iamcu") diff --git a/lld/test/ELF/format-binary.test b/lld/test/ELF/format-binary.test index 311cd773a40d..7c554bb60e43 100644 --- a/lld/test/ELF/format-binary.test +++ b/lld/test/ELF/format-binary.test @@ -61,3 +61,9 @@ # RUN: llvm-readobj %t.out -sections -section-data -symbols | FileCheck -check-prefix=X86-64 %s # X86-64: Format: ELF64-x86-64 + +# RUN: echo 'OUTPUT_FORMAT("elf64-x86-64")' > %t.script +# RUN: ld.lld -b binary %t.binary -T %t.script -o %t.out +# RUN: llvm-readobj %t.out -sections -section-data -symbols | FileCheck -check-prefix=X86-64-in-quotes %s + +# X86-64-in-quotes: Format: ELF64-x86-64