[Lldb-commits] [PATCH] Correctly resolve symbol names containing linker annotations

Pavel Labath labath at google.com
Tue Mar 3 09:33:02 PST 2015

Hi clayborg, jingham,

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 at VERSION), which causes issues when evaluating expressions
referencing memcpy for example (current glibc contains memcpy@@GLIBC_2.14 and
memcpy at 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.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8036.21111.patch
Type: text/x-patch
Size: 11872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150303/911854c2/attachment.bin>

More information about the lldb-commits mailing list