summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2016-01-19 10:24:51 +0000
committerTamas Berghammer <tberghammer@google.com>2016-01-19 10:24:51 +0000
commit8c6996f737fe941ce58366183c6bda2282b3054d (patch)
treefd37f4d3c578c3e906131a2fdae0978c67fb2daa /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
parent2a3810e8f7a45a118b5d55eb7f9d1e0cae363fd2 (diff)
downloadbcm5719-llvm-8c6996f737fe941ce58366183c6bda2282b3054d.tar.gz
bcm5719-llvm-8c6996f737fe941ce58366183c6bda2282b3054d.zip
Unconditionally accept symbol sizes from elf
The ELF symbol table always contain the size of the symbols so we don't have to try to guess them based on the address of the next symbol (it is needed for mach-o). The change fixes an issue when a symbol is removed after a 0 size symbol (e.g. because the second one is not public) what previously caused the symbol lookup algorithm to end up with showing the 0 size symbol even for the later addresses (what are not part of any symbol). That symbol lookup error can confuse the user and also confuses the current stack unwinder. Re-commit this CL after fixing the issue with gcc-4.9.2 on i386 Linux. Differential revision: http://reviews.llvm.org/D16186 llvm-svn: 258113
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index ea7c0640440..9f2cd4f3fd1 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2283,6 +2283,12 @@ ObjectFileELF::ParseSymbols (Symtab *symtab,
mangled.SetDemangledName( ConstString((demangled_name + suffix).str()) );
}
+ // In ELF all symbol should have a valid size but it is not true for some code symbols
+ // coming from hand written assembly. As none of the code symbol should have 0 size we try
+ // to calculate the size for these symbols in the symtab with saying that their original
+ // size is not valid.
+ bool symbol_size_valid = symbol.st_size != 0 || symbol_type != eSymbolTypeCode;
+
Symbol dc_symbol(
i + start_id, // ID is the original symbol table index.
mangled,
@@ -2295,7 +2301,7 @@ ObjectFileELF::ParseSymbols (Symtab *symtab,
symbol_section_sp, // Section in which this symbol is defined or null.
symbol_value, // Offset in section or symbol value.
symbol.st_size), // Size in bytes of this symbol.
- symbol.st_size != 0, // Size is valid if it is not 0
+ symbol_size_valid, // Symbol size is valid
has_suffix, // Contains linker annotations?
flags); // Symbol flags.
symtab->AddSymbol(dc_symbol);
@@ -2304,7 +2310,9 @@ ObjectFileELF::ParseSymbols (Symtab *symtab,
}
unsigned
-ObjectFileELF::ParseSymbolTable(Symtab *symbol_table, user_id_t start_id, lldb_private::Section *symtab)
+ObjectFileELF::ParseSymbolTable(Symtab *symbol_table,
+ user_id_t start_id,
+ lldb_private::Section *symtab)
{
if (symtab->GetObjectFile() != this)
{
OpenPOWER on IntegriCloud