diff --git a/lldb/include/lldb/Utility/ArchSpec.h b/lldb/include/lldb/Utility/ArchSpec.h index 7e9bc23a75acb..e817a3a8db017 100644 --- a/lldb/include/lldb/Utility/ArchSpec.h +++ b/lldb/include/lldb/Utility/ArchSpec.h @@ -99,6 +99,9 @@ class ArchSpec { eRISCV_float_abi_mask = 0x00000006, eRISCV_rve = 0x00000008, /// RVE, +e eRISCV_tso = 0x00000010, /// RVTSO (total store ordering) + eRISCV_cheri_abi = 0x10000000, + eRISCV_cap_mode = 0x20000000, + eRISCV_cheriot = 0x40000000, }; enum RISCVSubType { diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index e705c49742b3b..19983f197de3d 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1577,6 +1577,12 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec &arch, if ((arch_flags & ArchSpec::eRISCV_float_abi_quad) == ArchSpec::eRISCV_float_abi_quad) features_str += "+f,+d,+q,"; + if ((arch_flags & ArchSpec::eRISCV_cheri_abi) == ArchSpec::eRISCV_cheri_abi) + features_str += "+xcheri,"; + if ((arch_flags & ArchSpec::eRISCV_cap_mode) == ArchSpec::eRISCV_cap_mode) + features_str += "+cap-mode,"; + if ((arch_flags & ArchSpec::eRISCV_cheriot) == ArchSpec::eRISCV_cheriot) + features_str += "+xcheriot,"; // FIXME: how do we detect features such as `+a`, `+m`? // Turn them on by default now, since everyone seems to use them features_str += "+a,+m,"; diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 13e1198516f78..c16022483a121 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1433,6 +1433,16 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers, llvm::ELF::EF_RISCV_FLOAT_ABI_QUAD) flags |= ArchSpec::eRISCV_float_abi_quad; + if ((header.e_flags & llvm::ELF::EF_RISCV_CHERIABI) == + llvm::ELF::EF_RISCV_CHERIABI) + flags |= ArchSpec::eRISCV_cheri_abi; + if ((header.e_flags & llvm::ELF::EF_RISCV_CAP_MODE) == + llvm::ELF::EF_RISCV_CAP_MODE) + flags |= ArchSpec::eRISCV_cap_mode; + if ((header.e_flags & llvm::ELF::EF_RISCV_CHERIOT) == + llvm::ELF::EF_RISCV_CHERIOT) + flags |= ArchSpec::eRISCV_cheriot; + arch_spec.SetFlags(flags); }