Index: lld/trunk/ELF/InputFiles.cpp =================================================================== --- lld/trunk/ELF/InputFiles.cpp +++ lld/trunk/ELF/InputFiles.cpp @@ -226,6 +226,11 @@ if (Sections[I] == &InputSection::Discarded) continue; + if (Sec.sh_flags & SHF_EXCLUDE) { + Sections[I] = &InputSection::Discarded; + continue; + } + switch (Sec.sh_type) { case SHT_GROUP: Sections[I] = &InputSection::Discarded; Index: lld/trunk/test/ELF/exclude.s =================================================================== --- lld/trunk/test/ELF/exclude.s +++ lld/trunk/test/ELF/exclude.s @@ -0,0 +1,12 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld -o %t1 %t +# RUN: llvm-objdump -section-headers %t1 | FileCheck %s +# CHECK-NOT: .aaa + +.globl _start +_start: + jmp _start + +.section .aaa,"ae" + .quad 0