[ELF] SHF_MERGE section with 0 entsize is not fatal

For now just treat such sections as non-mergeable.

Differential Revision:	http://reviews.llvm.org/D18222

llvm-svn: 263660
This commit is contained in:
Ed Maste
2016-03-16 20:32:32 +00:00
parent c32ee0476b
commit 2e97115a61

View File

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