[lld] r263944 - Revert "[ELF] SHF_MERGE section with 0 entsize is not fatal"

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 07:57:21 PDT 2016


Author: rafael
Date: Mon Mar 21 09:57:20 2016
New Revision: 263944

URL: http://llvm.org/viewvc/llvm-project?rev=263944&view=rev
Log:
Revert "[ELF] SHF_MERGE section with 0 entsize is not fatal"

This reverts commit r263664.

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

Added:
    lld/trunk/test/ELF/Inputs/invalid-shentsize-zero.elf
      - copied, changed from r263933, lld/trunk/test/ELF/Inputs/merge-shentsize-zero.elf
Removed:
    lld/trunk/test/ELF/Inputs/merge-shentsize-zero.elf
    lld/trunk/test/ELF/merge-zero-size.test
Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/test/ELF/invalid-elf.test

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=263944&r1=263943&r2=263944&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Mon Mar 21 09:57:20 2016
@@ -148,9 +148,7 @@ template <class ELFT> static bool should
   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

Copied: lld/trunk/test/ELF/Inputs/invalid-shentsize-zero.elf (from r263933, lld/trunk/test/ELF/Inputs/merge-shentsize-zero.elf)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/invalid-shentsize-zero.elf?p2=lld/trunk/test/ELF/Inputs/invalid-shentsize-zero.elf&p1=lld/trunk/test/ELF/Inputs/merge-shentsize-zero.elf&r1=263933&r2=263944&rev=263944&view=diff
==============================================================================
Binary files - no diff available.

Removed: lld/trunk/test/ELF/Inputs/merge-shentsize-zero.elf
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/merge-shentsize-zero.elf?rev=263943&view=auto
==============================================================================
Binary file - no diff available.

Modified: lld/trunk/test/ELF/invalid-elf.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid-elf.test?rev=263944&r1=263943&r2=263944&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid-elf.test (original)
+++ lld/trunk/test/ELF/invalid-elf.test Mon Mar 21 09:57:20 2016
@@ -24,6 +24,10 @@
 # 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

Removed: lld/trunk/test/ELF/merge-zero-size.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-zero-size.test?rev=263943&view=auto
==============================================================================
--- lld/trunk/test/ELF/merge-zero-size.test (original)
+++ lld/trunk/test/ELF/merge-zero-size.test (removed)
@@ -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
-




More information about the llvm-commits mailing list