This revision was automatically updated to reflect the committed changes.
Closed by commit rL267405: Handle invalid values of PLT entry size generated by 
linker (authored by omjavaid).

Changed prior to commit:
  http://reviews.llvm.org/D19252?vs=54146&id=54845#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19252

Files:
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2610,7 +2610,10 @@
     elf_xword plt_entsize = plt_hdr->sh_addralign ?
         llvm::alignTo (plt_hdr->sh_entsize, plt_hdr->sh_addralign) : 
plt_hdr->sh_entsize;
 
-    if (plt_entsize == 0)
+    // Some linkers e.g ld for arm, fill plt_hdr->sh_entsize field incorrectly.
+    // PLT entries relocation code in general requires multiple instruction and
+    // should be greater than 4 bytes in most cases. Try to guess correct size 
just in case.
+    if (plt_entsize <= 4)
     {
         // The linker haven't set the plt_hdr->sh_entsize field. Try to guess 
the size of the plt
         // entries based on the number of entries and the size of the plt 
section with the


Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2610,7 +2610,10 @@
     elf_xword plt_entsize = plt_hdr->sh_addralign ?
         llvm::alignTo (plt_hdr->sh_entsize, plt_hdr->sh_addralign) : plt_hdr->sh_entsize;
 
-    if (plt_entsize == 0)
+    // Some linkers e.g ld for arm, fill plt_hdr->sh_entsize field incorrectly.
+    // PLT entries relocation code in general requires multiple instruction and
+    // should be greater than 4 bytes in most cases. Try to guess correct size just in case.
+    if (plt_entsize <= 4)
     {
         // The linker haven't set the plt_hdr->sh_entsize field. Try to guess the size of the plt
         // entries based on the number of entries and the size of the plt section with the
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to