Index: ELF/LinkerScript.cpp =================================================================== --- ELF/LinkerScript.cpp +++ ELF/LinkerScript.cpp @@ -211,8 +211,17 @@ void LinkerScript::readOutputFormat() { // Error checking only for now. expect("("); - next(); - expect(")"); + StringRef Tok = next(); + for (;;) { + Tok = next(); + if (Tok == ")") + return; + if (Tok == ",") + // Parse the identifier now. + next(); + continue; + error("unexpected token: " + Tok); + } } void LinkerScript::readSearchDir() { Index: test/elf2/linkerscript-ouputgroup.s =================================================================== --- test/elf2/linkerscript-ouputgroup.s +++ test/elf2/linkerscript-ouputgroup.s @@ -0,0 +1,5 @@ +# REQUIRES: x86 +# RUN: echo "OUTPUT_FORMAT(\"elf64-x86-64\")" > %t.script +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1 +# RUN: ld.lld2 -shared -o %t2 %t1 %t.script +# RUN: llvm-readobj %t2 > /dev/null