summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
diff options
context:
space:
mode:
authorOmair Javaid <omair.javaid@linaro.org>2016-04-25 13:45:39 +0000
committerOmair Javaid <omair.javaid@linaro.org>2016-04-25 13:45:39 +0000
commitcbd7f8847ee9d5dc7283fcbbcf79ac1cc7ff6807 (patch)
tree5183ab54f1b3187486eda3bcf889f6b51fee17cd /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
parent517d8d2f9408718312e7d2d9fdbabe4c64bf0314 (diff)
downloadbcm5719-llvm-cbd7f8847ee9d5dc7283fcbbcf79ac1cc7ff6807.tar.gz
bcm5719-llvm-cbd7f8847ee9d5dc7283fcbbcf79ac1cc7ff6807.zip
Handle invalid values of PLT entry size generated by linker
Make sure we figure out correct plt entry field in case linker has generated a small value below realistic entry size like 4 bytes or below. Differential revision: http://reviews.llvm.org/D19252 llvm-svn: 267405
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index c599dc361cc..7d79010ae76 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2610,7 +2610,10 @@ GetPltEntrySizeAndOffset(const ELFSectionHeader* rel_hdr, const ELFSectionHeader
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
OpenPOWER on IntegriCloud