diff options
-rw-r--r-- | lld/ELF/InputFiles.cpp | 5 | ||||
-rw-r--r-- | lld/test/ELF/exclude.s | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 7d6a36815cd..d9d8df50a08 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -226,6 +226,11 @@ void elf::ObjectFile<ELFT>::initializeSections( if (Sections[I] == &InputSection<ELFT>::Discarded) continue; + if (Sec.sh_flags & SHF_EXCLUDE) { + Sections[I] = &InputSection<ELFT>::Discarded; + continue; + } + switch (Sec.sh_type) { case SHT_GROUP: Sections[I] = &InputSection<ELFT>::Discarded; diff --git a/lld/test/ELF/exclude.s b/lld/test/ELF/exclude.s new file mode 100644 index 00000000000..addc3dc72ec --- /dev/null +++ b/lld/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 |