[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.

This is a recommit of f114f00948 with a new test
setup that doesn't involves (unsupported) corefiles.

Differential Revision: https://reviews.llvm.org/D124760
This commit is contained in:
serge-sans-paille
2022-05-02 12:19:48 +02:00
parent 405bf90235
commit f416e57339
5 changed files with 84 additions and 7 deletions

View File

@@ -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);