summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-03-27 02:40:46 +0000
committerGreg Clayton <gclayton@apple.com>2012-03-27 02:40:46 +0000
commit47037bc4d71702cf5de20f179ebbfc2b51fe631f (patch)
tree01f1292ce41c652dbe1b32e53ce9db1bee78fdf1 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
parentc5bc412cf6cb8ca4a8aaa33b36519affea73f9b7 (diff)
downloadbcm5719-llvm-47037bc4d71702cf5de20f179ebbfc2b51fe631f.tar.gz
bcm5719-llvm-47037bc4d71702cf5de20f179ebbfc2b51fe631f.zip
Fixed a few things in the ELF object file:
1 - sections only get a valid VM size if they have SHF_ALLOC in the section flags 2 - symbol names are marked as mangled if they start with "_Z" Also fixed the DWARF parser to correctly use the section file size when extracting the DWARF. llvm-svn: 153496
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 930415abe47..a024d1b3148 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -615,7 +615,8 @@ ObjectFileELF::GetSectionList()
const ELFSectionHeader &header = *I;
ConstString name(m_shstr_data.PeekCStr(header.sh_name));
- uint64_t size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
+ const uint64_t file_size = header.sh_type == SHT_NOBITS ? 0 : header.sh_size;
+ const uint64_t vm_size = header.sh_flags & SHF_ALLOC ? header.sh_size : 0;
static ConstString g_sect_name_text (".text");
static ConstString g_sect_name_data (".data");
@@ -658,9 +659,9 @@ ObjectFileELF::GetSectionList()
name, // Section name.
sect_type, // Section type.
header.sh_addr, // VM address.
- header.sh_size, // VM size in bytes of this section.
+ vm_size, // VM size in bytes of this section.
header.sh_offset, // Offset of this section in the file.
- size, // Size of the section as found in the file.
+ file_size, // Size of the section as found in the file.
header.sh_flags)); // Flags for this section.
m_sections_ap->AddSection(section);
@@ -781,11 +782,11 @@ ParseSymbols(Symtab *symtab,
const char *symbol_name = strtab_data.PeekCStr(symbol.st_name);
bool is_global = symbol.getBinding() == STB_GLOBAL;
uint32_t flags = symbol.st_other << 8 | symbol.st_info;
-
+ bool is_mangled = symbol_name ? (symbol_name[0] == '_' && symbol_name[1] == 'Z') : false;
Symbol dc_symbol(
i + start_id, // ID is the original symbol table index.
symbol_name, // Symbol name.
- false, // Is the symbol name mangled?
+ is_mangled, // Is the symbol name mangled?
symbol_type, // Type of this symbol
is_global, // Is this globally visible?
false, // Is this symbol debug info?
@@ -976,11 +977,12 @@ ParsePLTRelocations(Symtab *symbol_table,
break;
const char *symbol_name = strtab_data.PeekCStr(symbol.st_name);
+ bool is_mangled = symbol_name ? (symbol_name[0] == '_' && symbol_name[1] == 'Z') : false;
Symbol jump_symbol(
i + start_id, // Symbol table index
symbol_name, // symbol name.
- false, // is the symbol name mangled?
+ is_mangled, // is the symbol name mangled?
eSymbolTypeTrampoline, // Type of this symbol
false, // Is this globally visible?
false, // Is this symbol debug info?
OpenPOWER on IntegriCloud