Skip to content

Commit

Permalink
[SOL] Fix SBF target in LLDB
Browse files Browse the repository at this point in the history
  • Loading branch information
dmakarov authored and LucasSte committed Jun 28, 2024
1 parent 9cedb0a commit 8547b3f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lldb/include/lldb/Utility/ArchSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ class ArchSpec {
eBPF_abi_sbf_v2 = 0x00000020,
};

enum BPFSubType {
eBPFSubType_sbf,
eBPFSubType_sbfv2,
enum SBFSubType {
eSBFSubType_sbf,
eSBFSubType_sbfv2,
};

enum RISCVSubType {
Expand Down
8 changes: 5 additions & 3 deletions lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
return true;
}

static uint32_t bpfVariantFromElfFlags(const elf::ELFHeader &header) {
static uint32_t sbfVariantFromElfFlags(const elf::ELFHeader &header) {
if (header.e_flags & llvm::ELF::EF_SBF_V2)
return ArchSpec::eBPFSubType_sbfv2;
return ArchSpec::eBPFSubType_sbf;
return ArchSpec::eSBFSubType_sbfv2;
return ArchSpec::eSBFSubType_sbf;
}

static uint32_t mipsVariantFromElfFlags (const elf::ELFHeader &header) {
Expand Down Expand Up @@ -350,6 +350,8 @@ static uint32_t subTypeFromElfHeader(const elf::ELFHeader &header) {
return loongarchVariantFromElfFlags(header);
else if (header.e_machine == llvm::ELF::EM_BPF)
return bpfVariantFromElfFlags(header);
else if (header.e_machine == llvm::ELF::EM_SBF)
return sbfVariantFromElfFlags(header);

return LLDB_INVALID_CPUTYPE;
}
Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Utility/ArchSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ static const ArchDefinitionEntry g_elf_arch_entries[] = {
{ArchSpec::eCore_loongarch64, llvm::ELF::EM_LOONGARCH,
ArchSpec::eLoongArchSubType_loongarch64, 0xFFFFFFFFu,
0xFFFFFFFFu}, // loongarch64
{ArchSpec::eCore_sbf, llvm::ELF::EM_BPF, ArchSpec::eBPFSubType_sbf,
{ArchSpec::eCore_sbf, llvm::ELF::EM_SBF, ArchSpec::eSBFSubType_sbf,
0xFFFFFFFFu, 0xFFFFFFFFu}, // sbf
{ArchSpec::eCore_sbfv2, llvm::ELF::EM_BPF, ArchSpec::eBPFSubType_sbfv2,
{ArchSpec::eCore_sbfv2, llvm::ELF::EM_SBF, ArchSpec::eSBFSubType_sbfv2,
0xFFFFFFFFu, 0xFFFFFFFFu}, // sbfv2
};

Expand Down

0 comments on commit 8547b3f

Please sign in to comment.