diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-14 14:36:29 +0000 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2016-04-14 14:36:29 +0000 |
commit | bd5262629dcb00ab17cfa5331e3815a3eeff8124 (patch) | |
tree | 482ee64727bce555ec7b17c7223b3bbb75604ae7 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | |
parent | 7e8de59b9059a2eec1367f32c0a06561f5e025ac (diff) | |
download | bcm5719-llvm-bd5262629dcb00ab17cfa5331e3815a3eeff8124.tar.gz bcm5719-llvm-bd5262629dcb00ab17cfa5331e3815a3eeff8124.zip |
Find .plt section in object files generated by recent ld
Code in ObjectFileELF::ParseTrampolineSymbols assumes that the sh_info
field of the .rel(a).plt section identifies the .plt section.
However, with recent GNU ld this is no longer true. As a result of this:
https://sourceware.org/bugzilla/show_bug.cgi?id=18169
in object files generated with current linkers the sh_info field of
.rel(a).plt now points to the .got.plt section (or .got on some targets).
This causes LLDB to fail to identify any PLT stubs, causing a number of
test case failures.
This patch changes LLDB to simply always look for the .plt section by
name. This should be safe across all linkers and targets.
Differential Revision: http://reviews.llvm.org/D18973
llvm-svn: 266316
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 32cc85d01be..bb388d45e36 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -2611,17 +2611,17 @@ ObjectFileELF::ParseTrampolineSymbols(Symtab *symbol_table, { assert(rel_hdr->sh_type == SHT_RELA || rel_hdr->sh_type == SHT_REL); - // The link field points to the associated symbol table. The info field - // points to the section holding the plt. + // The link field points to the associated symbol table. user_id_t symtab_id = rel_hdr->sh_link; - user_id_t plt_id = rel_hdr->sh_info; // If the link field doesn't point to the appropriate symbol name table then // try to find it by name as some compiler don't fill in the link fields. if (!symtab_id) symtab_id = GetSectionIndexByName(".dynsym"); - if (!plt_id) - plt_id = GetSectionIndexByName(".plt"); + + // Get PLT section. We cannot use rel_hdr->sh_info, since current linkers + // point that to the .got.plt or .got section instead of .plt. + user_id_t plt_id = GetSectionIndexByName(".plt"); if (!symtab_id || !plt_id) return 0; |