[clang] [Clang][RISCV] Add preprocessor macros for Zicfilp CFI scheme (PR #109600)
Ming-Yi Lai via cfe-commits
cfe-commits at lists.llvm.org
Tue May 13 04:06:31 PDT 2025
================
@@ -238,6 +238,25 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
else
Builder.defineMacro("__riscv_32e");
}
+
+ if (Opts.CFProtectionBranch) {
+ auto Scheme = Opts.getCFBranchLabelScheme();
+ if (Scheme == CFBranchLabelSchemeKind::Default)
+ Scheme = getDefaultCFBranchLabelScheme();
+
+ Builder.defineMacro("__riscv_landing_pad");
+ switch (Scheme) {
+ case CFBranchLabelSchemeKind::Unlabeled:
+ Builder.defineMacro("__riscv_landing_pad_unlabeled");
+ break;
+ case CFBranchLabelSchemeKind::FuncSig:
+ Builder.defineMacro("__riscv_landing_pad_func_sig");
+ break;
----------------
mylai-mtk wrote:
Used Option 1 to drop the func-sig part for now
https://github.com/llvm/llvm-project/pull/109600
More information about the cfe-commits
mailing list