forked from OSchip/llvm-project
[ELF] SHF_MERGE section with 0 entsize is not fatal
For now just treat such sections as non-mergeable. Resubmit r263660 with test fix. Differential Revision: http://reviews.llvm.org/D18225 llvm-svn: 263664
This commit is contained in:
parent
19c6159833
commit
b321050a93
|
@ -148,7 +148,9 @@ template <class ELFT> static bool shouldMerge(const typename ELFT::Shdr &Sec) {
|
|||
if (Flags & SHF_WRITE)
|
||||
fatal("writable SHF_MERGE sections are not supported");
|
||||
uintX_t EntSize = Sec.sh_entsize;
|
||||
if (!EntSize || Sec.sh_size % EntSize)
|
||||
if (!EntSize)
|
||||
return false;
|
||||
if (Sec.sh_size % EntSize)
|
||||
fatal("SHF_MERGE section size must be a multiple of sh_entsize");
|
||||
|
||||
// Don't try to merge if the aligment is larger than the sh_entsize and this
|
||||
|
|
|
@ -24,10 +24,6 @@
|
|||
# RUN: FileCheck --check-prefix=INVALID-SECTION-INDEX %s
|
||||
# INVALID-SECTION-INDEX: Invalid section index
|
||||
|
||||
# RUN: not ld.lld %p/Inputs/invalid-shentsize-zero.elf -o %t2 2>&1 | \
|
||||
# RUN: FileCheck --check-prefix=INVALID-SHENTSIZE-ZERO %s
|
||||
# INVALID-SHENTSIZE-ZERO: SHF_MERGE section size must be a multiple of sh_entsize
|
||||
|
||||
# RUN: not ld.lld %p/Inputs/invalid-multiple-eh-relocs.elf -o %t2 2>&1 | \
|
||||
# RUN: FileCheck --check-prefix=INVALID-EH-RELOCS %s
|
||||
# INVALID-EH-RELOCS: multiple relocation sections to .eh_frame are not supported
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# RUN: ld.lld %p/Inputs/merge-shentsize-zero.elf -o %t2 2>&1 | \
|
||||
# RUN: FileCheck -allow-empty %s
|
||||
# CHECK-NOT: SHF_MERGE section size must be a multiple of sh_entsize
|
||||
|
Loading…
Reference in New Issue