Skip to content

Commit 9d78d21

Browse files
committed
[CHERIoT] Convert a few places from checking the subarch to checking for the XCheriot ISA feature.
1 parent bfbfac6 commit 9d78d21

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

clang/lib/Basic/Targets/RISCV.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
245245
}
246246

247247
// Macros for use with the set and get permissions builtins.
248-
if (getTriple().getSubArch() == llvm::Triple::RISCV32SubArch_cheriot_v1) {
248+
if (ISAInfo->hasExtension("xcheriot")) {
249249
// Expose CHERI-compatible macros for permissions that overlap with other
250250
// CHERI implementations.
251251
Builder.defineMacro("__CHERI_CAP_PERMISSION_GLOBAL__", Twine(1 << 0));
@@ -379,6 +379,7 @@ bool RISCVTargetInfo::initFeatureMap(
379379

380380
if (getTriple().getSubArch() == llvm::Triple::RISCV32SubArch_cheriot_v1) {
381381
Features["xcheri"] = true;
382+
Features["xcheriot"] = true;
382383
Features["cap-mode"] = true;
383384
Features["c"] = true;
384385
Features["e"] = true;

llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ unsigned RISCVELFObjectWriter::getRelocType(MCContext &Ctx,
108108
return ELF::R_RISCV_CHERI_CJAL;
109109
case RISCV::fixup_riscv_ccall: {
110110
const auto *STI = Ctx.getSubtargetInfo();
111-
if (STI->hasFeature(RISCV::FeatureVendorXCheriot) ||
112-
STI->getTargetTriple().getSubArch() ==
113-
Triple::RISCV32SubArch_cheriot_v1)
111+
if (STI->hasFeature(RISCV::FeatureVendorXCheriot))
114112
return ELF::R_RISCV_CHERIOT_CCALL;
115113
return ELF::R_RISCV_CHERI_CCALL;
116114
}

0 commit comments

Comments
 (0)