Revert "[ELF] SHF_MERGE section with 0 entsize is not fatal"
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 21 Mar 2016 14:57:20 +0000 (14:57 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 21 Mar 2016 14:57:20 +0000 (14:57 +0000)
This reverts commit r263664.

The reason we were getting broken files was lld -r, and that has been
fixed.

llvm-svn: 263944

lld/ELF/InputFiles.cpp
lld/test/ELF/Inputs/invalid-shentsize-zero.elf [moved from lld/test/ELF/Inputs/merge-shentsize-zero.elf with 100% similarity]
lld/test/ELF/invalid-elf.test
lld/test/ELF/merge-zero-size.test [deleted file]

index e8ee581..3622dc2 100644 (file)
@@ -148,9 +148,7 @@ 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)
-    return false;
-  if (Sec.sh_size % EntSize)
+  if (!EntSize || 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
index 73516a4..c3a97d3 100644 (file)
 # 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
diff --git a/lld/test/ELF/merge-zero-size.test b/lld/test/ELF/merge-zero-size.test
deleted file mode 100644 (file)
index e00b7a2..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# 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
-