diff options
author | Michael Sartain <mikesart@valvesoftware.com> | 2013-08-22 21:25:53 +0000 |
---|---|---|
committer | Michael Sartain <mikesart@valvesoftware.com> | 2013-08-22 21:25:53 +0000 |
commit | f7899545add32315dbeff8835bb53577296f4233 (patch) | |
tree | d61cde1753a5c65b928ad26af996a0b2a6b01f12 | |
parent | c9ed430a3a0c718a5914f0ac02d2b5870178180d (diff) | |
download | bcm5719-llvm-f7899545add32315dbeff8835bb53577296f4233.tar.gz bcm5719-llvm-f7899545add32315dbeff8835bb53577296f4233.zip |
Round plt entsize to addralign
llvm-svn: 189066
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 2e9f6903280..f09151c7acf 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1280,6 +1280,11 @@ ObjectFileELF::FindDynamicSymbol(unsigned tag) unsigned ObjectFileELF::PLTRelocationType() { + // DT_PLTREL + // This member specifies the type of relocation entry to which the + // procedure linkage table refers. The d_val member holds DT_REL or + // DT_RELA, as appropriate. All relocations in a procedure linkage table + // must use the same relocation. const ELFDynamic *symbol = FindDynamicSymbol(DT_PLTREL); if (symbol) @@ -1304,7 +1309,10 @@ ParsePLTRelocations(Symtab *symbol_table, ELFRelocation rel(rel_type); ELFSymbol symbol; lldb::offset_t offset = 0; - const elf_xword plt_entsize = plt_hdr->sh_entsize; + // Clang 3.3 sets entsize to 4 for 32-bit binaries, but the plt entries are 16 bytes. + // So round the entsize up by the alignment if addralign is set. + const elf_xword plt_entsize = plt_hdr->sh_addralign ? + llvm::RoundUpToAlignment (plt_hdr->sh_entsize, plt_hdr->sh_addralign) : plt_hdr->sh_entsize; const elf_xword num_relocations = rel_hdr->sh_size / rel_hdr->sh_entsize; typedef unsigned (*reloc_info_fn)(const ELFRelocation &rel); @@ -1479,10 +1487,17 @@ ObjectFileELF::GetSymtab() if (symtab) symbol_id += ParseSymbolTable (m_symtab_ap.get(), symbol_id, symtab); - // Synthesize trampoline symbols to help navigate the PLT. + // DT_JMPREL + // If present, this entry's d_ptr member holds the address of relocation + // entries associated solely with the procedure linkage table. Separating + // these relocation entries lets the dynamic linker ignore them during + // process initialization, if lazy binding is enabled. If this entry is + // present, the related entries of types DT_PLTRELSZ and DT_PLTREL must + // also be present. const ELFDynamic *symbol = FindDynamicSymbol(DT_JMPREL); if (symbol) { + // Synthesize trampoline symbols to help navigate the PLT. addr_t addr = symbol->d_ptr; Section *reloc_section = section_list->FindSectionContainingFileAddress(addr).get(); if (reloc_section) |