[clang] [llvm] [ARM][KCFI] Add backend support for Kernel Control-Flow Integrity (PR #163698)

Sami Tolvanen via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 16 10:58:53 PDT 2025


================
@@ -687,7 +687,9 @@ static void addKCFIPass(const Triple &TargetTriple, const LangOptions &LangOpts,
                         PassBuilder &PB) {
   // If the back-end supports KCFI operand bundle lowering, skip KCFIPass.
   if (TargetTriple.getArch() == llvm::Triple::x86_64 ||
-      TargetTriple.isAArch64(64) || TargetTriple.isRISCV())
+      TargetTriple.isAArch64(64) || TargetTriple.isRISCV() ||
+      TargetTriple.getArch() == llvm::Triple::arm ||
----------------
samitolvanen wrote:

Looks like `Triple::isARM()` already has the exact same check, so this didn't actually change the behavior:
```C++
  /// Tests whether the target is ARM (little and big endian).
  bool isARM() const {
    return getArch() == Triple::arm || getArch() == Triple::armeb;
  }
```
Also, Thumb mode can be enabled separately for each function using `__attribute__((target("thumb")))`, which means checking the triple here isn't sufficient to detect mixed ARM/Thumb code...

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


More information about the cfe-commits mailing list