summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF
diff options
context:
space:
mode:
authorMatthew Gardiner <mg11@csr.com>2014-09-29 08:02:24 +0000
committerMatthew Gardiner <mg11@csr.com>2014-09-29 08:02:24 +0000
commitf03e6d84bc649ff230b197fb9c2dffaeebd9edef (patch)
treebc5f86fcf3fa13ed82aaaae36a00d6401be32b6c /lldb/source/Plugins/ObjectFile/ELF
parent1779d438bc389f0cb67ecd3d9fed7d13bca7db39 (diff)
downloadbcm5719-llvm-f03e6d84bc649ff230b197fb9c2dffaeebd9edef.tar.gz
bcm5719-llvm-f03e6d84bc649ff230b197fb9c2dffaeebd9edef.zip
Very minimal support 24-bit kalimbas. Vanilla "memory read" for data sections
works, as do breakpoints, run and pause, display zeroth frame. See http://reviews.llvm.org/D5503 for a fuller description of the changes in this commit. llvm-svn: 218596
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp46
1 files changed, 43 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index d075312c84c..fa11751b7aa 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -267,10 +267,14 @@ kalimbaVariantFromElfFlags(const elf::elf_word e_flags)
{
// TODO(mg11) Support more variants
case 10:
- kal_arch_variant = 3;
+ kal_arch_variant = llvm::Triple::KalimbaSubArch_v3;
break;
case 14:
- kal_arch_variant = 4;
+ kal_arch_variant = llvm::Triple::KalimbaSubArch_v4;
+ break;
+ case 17:
+ case 20:
+ kal_arch_variant = llvm::Triple::KalimbaSubArch_v5;
break;
default:
break;
@@ -287,6 +291,27 @@ 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.
+static lldb::SectionType
+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)
+ {
+ return eSectionTypeOther;
+ }
+
+ const lldb::addr_t KAL_CODE_BIT = 1 << 31;
+ return KAL_CODE_BIT & sect_hdr.sh_addr ?
+ eSectionTypeCode : eSectionTypeData;
+}
+
// Arbitrary constant used as UUID prefix for core files.
const uint32_t
ObjectFileELF::g_core_uuid_magic(0xE210C);
@@ -1592,6 +1617,20 @@ ObjectFileELF::CreateSections(SectionList &unified_section_list)
break;
}
+ if (eSectionTypeOther == sect_type)
+ {
+ // the kalimba toolchain assumes that ELF section names are free-form. It does
+ // supports linkscripts which (can) give rise to various arbitarily named
+ // sections being "Code" or "Data".
+ sect_type = kalimbaSectionType(m_header, header);
+ }
+
+ const uint32_t target_bytes_size =
+ eSectionTypeData == sect_type ?
+ m_arch_spec.GetDataByteSize() :
+ eSectionTypeCode == sect_type ?
+ m_arch_spec.GetCodeByteSize() : 1;
+
elf::elf_xword log2align = (header.sh_addralign==0)
? 0
: llvm::Log2_64(header.sh_addralign);
@@ -1605,7 +1644,8 @@ ObjectFileELF::CreateSections(SectionList &unified_section_list)
header.sh_offset, // Offset of this section in the file.
file_size, // Size of the section as found in the file.
log2align, // Alignment of the section
- header.sh_flags)); // Flags for this section.
+ header.sh_flags, // Flags for this section.
+ target_bytes_size));// Number of host bytes per target byte
if (is_thread_specific)
section_sp->SetIsThreadSpecific (is_thread_specific);
OpenPOWER on IntegriCloud