Index: lld/trunk/ELF/LinkerScript.cpp =================================================================== --- lld/trunk/ELF/LinkerScript.cpp +++ lld/trunk/ELF/LinkerScript.cpp @@ -1080,6 +1080,9 @@ return; } + if (Sec->Type == SHT_NOBITS) + return; + // Write leading padding. ArrayRef Sections = Sec->Sections; uint32_t Filler = getFiller(); Index: lld/trunk/test/ELF/linkerscript/bss-fill.s =================================================================== --- lld/trunk/test/ELF/linkerscript/bss-fill.s +++ lld/trunk/test/ELF/linkerscript/bss-fill.s @@ -0,0 +1,7 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o +# RUN: echo "SECTIONS { .bss : { . += 0x10000; *(.bss) } =0xFF };" > %t.script +# RUN: ld.lld -o %t --script %t.script %t.o + +.section .bss,"",@nobits +.short 0