summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
diff options
context:
space:
mode:
authorMatthew Gardiner <mg11@csr.com>2014-10-15 08:21:54 +0000
committerMatthew Gardiner <mg11@csr.com>2014-10-15 08:21:54 +0000
commit6e7b0a088e9f2efb4cb0c1a5bfe6606b3946353f (patch)
treec8ab20b5f2b6c4296ef4af200149c80d97779e25 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
parentb00ddf31b257557efdc1e5e1dbe8325c290dea47 (diff)
downloadbcm5719-llvm-6e7b0a088e9f2efb4cb0c1a5bfe6606b3946353f.tar.gz
bcm5719-llvm-6e7b0a088e9f2efb4cb0c1a5bfe6606b3946353f.zip
Improve the handling of kalimba ELF file section type recognition.
Recognise the SHT_NOBITS property in kalimba ELF, and determine this to be of type zerofilled. Subsequently recognise this type to represent bytes on the target's DATA address space, and therefore be sized accordingly. llvm-svn: 219782
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index fa11751b7aa..ea64ff24c00 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -291,7 +291,6 @@ subTypeFromElfHeader(const elf::ELFHeader& header)
LLDB_INVALID_CPUTYPE;
}
-//! brief kalimbaSectionType
//! The kalimba toolchain identifies a code section as being
//! one with the SHT_PROGBITS set in the section sh_type and the top
//! bit in the 32-bit address field set.
@@ -300,16 +299,24 @@ kalimbaSectionType(
const elf::ELFHeader& header,
const elf::ELFSectionHeader& sect_hdr)
{
- if (
- llvm::ELF::EM_CSR_KALIMBA != header.e_machine ||
- llvm::ELF::SHT_PROGBITS != sect_hdr.sh_type)
+ if (llvm::ELF::EM_CSR_KALIMBA != header.e_machine)
{
return eSectionTypeOther;
}
- const lldb::addr_t KAL_CODE_BIT = 1 << 31;
- return KAL_CODE_BIT & sect_hdr.sh_addr ?
- eSectionTypeCode : eSectionTypeData;
+ if (llvm::ELF::SHT_NOBITS == sect_hdr.sh_type)
+ {
+ return eSectionTypeZeroFill;
+ }
+
+ if (llvm::ELF::SHT_PROGBITS == sect_hdr.sh_type)
+ {
+ const lldb::addr_t KAL_CODE_BIT = 1 << 31;
+ return KAL_CODE_BIT & sect_hdr.sh_addr ?
+ eSectionTypeCode : eSectionTypeData;
+ }
+
+ return eSectionTypeOther;
}
// Arbitrary constant used as UUID prefix for core files.
@@ -1626,7 +1633,7 @@ ObjectFileELF::CreateSections(SectionList &unified_section_list)
}
const uint32_t target_bytes_size =
- eSectionTypeData == sect_type ?
+ (eSectionTypeData == sect_type || eSectionTypeZeroFill == sect_type) ?
m_arch_spec.GetDataByteSize() :
eSectionTypeCode == sect_type ?
m_arch_spec.GetCodeByteSize() : 1;
OpenPOWER on IntegriCloud