[ELF2] - Fixed crash for case when section sh_entsize is set to zero for SHF_MERGE type of sections.
Differential revision: http://reviews.llvm.org/D14451
llvm-svn: 252454
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 364b388..2905f99 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -143,7 +143,7 @@
if (Flags & SHF_WRITE)
error("Writable SHF_MERGE sections are not supported");
uintX_t EntSize = Sec.sh_entsize;
- if (Sec.sh_size % EntSize)
+ if (!EntSize || Sec.sh_size % EntSize)
error("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.