[ELF] Ignore sections flagged with SHF_EXCLUDE

Differential revision: https://reviews.llvm.org/D24966

llvm-svn: 282568
This commit is contained in:
Eugene Leviant 2016-09-28 08:42:02 +00:00
parent 3e06eafc20
commit 27be542cdf
2 changed files with 17 additions and 0 deletions

View File

@ -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;

12
lld/test/ELF/exclude.s Normal file
View File

@ -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