[clang] [Clang][RISCV] Add preprocessor macros for Zicfilp CFI scheme (PR #109600)

Kito Cheng via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 17 01:03:03 PST 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;
----------------
kito-cheng wrote:

Drop this since this not really functional work on upstream LLVM yet, this may misleading user that already implemented.

https://github.com/llvm/llvm-project/pull/109600


More information about the cfe-commits mailing list