Index: lld/trunk/ELF/LinkerScript.cpp =================================================================== --- lld/trunk/ELF/LinkerScript.cpp +++ lld/trunk/ELF/LinkerScript.cpp @@ -1471,6 +1471,9 @@ else if (peek().startswith("=")) Cmd->Filler = readOutputSectionFiller(next().drop_front()); + // Consume optional comma following output section command. + consume(","); + return Cmd; } Index: lld/trunk/test/ELF/linkerscript/sections-padding.s =================================================================== --- lld/trunk/test/ELF/linkerscript/sections-padding.s +++ lld/trunk/test/ELF/linkerscript/sections-padding.s @@ -36,6 +36,11 @@ # RUN: ld.lld -o %t.out --script %t.script %t # RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s +## Check case with optional comma following output section command: +# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x1122, .a : { *(.a*) } }" > %t.script +# RUN: ld.lld -o %t.out --script %t.script %t +# RUN: llvm-objdump -s %t.out | FileCheck -check-prefix=YES %s + .section .mysec.1,"a" .align 16 .byte 0x66