aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/IRObjectFile.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2015-03-04 10:25:22 +0000
committerPavel Labath <labath@google.com>2015-03-04 10:25:22 +0000
commitc6ae7eaa7b41031e87a4f807a18ee9b163409275 (patch)
treee7e37759e5dae75cdd3e613e3f22946ade4fbbe1 /llvm/lib/Object/IRObjectFile.cpp
parentaea8461820908d143de43e4230b7483cbae50c4e (diff)
downloadllvm-c6ae7eaa7b41031e87a4f807a18ee9b163409275.zip
llvm-c6ae7eaa7b41031e87a4f807a18ee9b163409275.tar.gz
llvm-c6ae7eaa7b41031e87a4f807a18ee9b163409275.tar.bz2
Correctly resolve symbol names containing linker annotations
Summary: Symbols in ELF files can be versioned, but LLDB currently does not understand these. This problem becomes apparent once one loads glibc with debug info. Here (in the .symtab section) the versions are embedded in the name (name@VERSION), which causes issues when evaluating expressions referencing memcpy for example (current glibc contains memcpy@@GLIBC_2.14 and memcpy@GLIBC_2.2.5). This problem was not evident without debug symbols as the .dynsym section stores the bare names and the actual versions are present in a separate section (.gnu.version_d), which LLDB ignores. This resulted in two definitions of memcpy in the symbol table. This patch adds support for storing annotated names to the Symbol class. If Symbol.m_contains_linker_annotations is true then this symbol is annotated. Unannotated name can be obtained by calling StripLinkerAnnotations on the corresponding ObjectFile. ObjectFileELF implements this to strip @VERSION suffixes when requested. Symtab uses this function to add the bare name as well as the annotated name to the name lookup table. To preserve the size of the Symbol class, I had to steal one bit from the m_type field. Test Plan: This fixes TestExprHelpExamples.py when run with a glibc with debug symbols. Writing an environment agnostic test case would require building a custom shared library with symbol versions and testing symbol resolution against that, which is somewhat challenging. Reviewers: clayborg, jingham Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8036 llvm-svn: 231228
Diffstat (limited to 'llvm/lib/Object/IRObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions