aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
diff options
context:
space:
mode:
authorserge-sans-paille <sguelton@redhat.com>2022-05-02 12:19:48 +0200
committerserge-sans-paille <sguelton@redhat.com>2022-05-03 12:17:23 +0200
commitf114f009486816ed4b3bf984f0fbbb8fc80914f6 (patch)
tree7adb3be0545c794ebe0a54546ccb1958df8d2b51 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
parent74634f4b9807d51b9e723b1ced0c18954893bc6c (diff)
downloadllvm-f114f009486816ed4b3bf984f0fbbb8fc80914f6.zip
llvm-f114f009486816ed4b3bf984f0fbbb8fc80914f6.tar.gz
llvm-f114f009486816ed4b3bf984f0fbbb8fc80914f6.tar.bz2
[lldb] Fix ppc64 detection in lldb
Currently, ppc64le and ppc64 (defaulting to big endian) have the same descriptor, thus the linear scan always return ppc64le. Handle that through subtype. Differential Revision: https://reviews.llvm.org/D124760
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 684d070..28ccfbe 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -310,9 +310,19 @@ static uint32_t riscvVariantFromElfFlags(const elf::ELFHeader &header) {
}
}
+static uint32_t ppc64VariantFromElfFlags(const elf::ELFHeader &header) {
+ uint32_t endian = header.e_ident[EI_DATA];
+ if (endian == ELFDATA2LSB)
+ return ArchSpec::eCore_ppc64le_generic;
+ else
+ return ArchSpec::eCore_ppc64_generic;
+}
+
static uint32_t subTypeFromElfHeader(const elf::ELFHeader &header) {
if (header.e_machine == llvm::ELF::EM_MIPS)
return mipsVariantFromElfFlags(header);
+ else if (header.e_machine == llvm::ELF::EM_PPC64)
+ return ppc64VariantFromElfFlags(header);
else if (header.e_machine == llvm::ELF::EM_RISCV)
return riscvVariantFromElfFlags(header);