[clang] [llvm] [RISCV][Zicfilp] Enable Zicfilp CFI compiler behaviors by looking at module flags (PR #152121)
Ming-Yi Lai via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 4 00:06:25 PDT 2025
================
@@ -1802,3 +1800,15 @@ def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals",
"AllowTaggedGlobals",
"true", "Use an instruction sequence for taking the address of a global "
"that allows a memory tag in the upper address bits">;
+
+// Zicfilp-based CFI
+def FeatureZicfilpUnlabeled
+ : SubtargetFeature<
+ "zicfilp-unlabeled", "HasZicfilpUnlabeled", "true",
+ "Enforce forward-edge control-flow integrity with ZICFILP-unlabeled">;
+def FeatureZicfilpFuncSig
+ : SubtargetFeature<
+ "zicfilp-func-sig", "HasZicfilpFuncSig", "true",
+ "Enforce forward-edge control-flow integrity with ZICFILP-func-sig">;
----------------
mylai-mtk wrote:
In the end, I decided to still implement this series of features as enum target features, since when prototyping riscv-non-isa/riscv-elf-psabi-doc#474 , the disassembler would only know that zicfilp-cfi is enabled, but has no idea about the scheme. As a result, a generic indicator target feature "zicfilp-cfi" is needed, which could be overridden by the zicfilp-unlabeled/zicfilp-func-sig enum. This kinda uses the overriding semantics of enum target features, though still not a perfect match.
https://github.com/llvm/llvm-project/pull/152121
More information about the llvm-commits
mailing list