[clang] [llvm] [X86][KCFI] Do not emit a type prefix for nocf_check functions (PR #158133)

Sami Tolvanen via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 15 14:13:03 PDT 2025


samitolvanen wrote:

> I modified the `nocf_check` attribute handler to check for either `-cf-protection` or `-fsanitize=kcfi` being enabled.

Looking at this a bit closer, the `nocf_check` attribute also applies to function pointers with `-fcf-protection`, and disables tracking for indirect branches. Since KCFI already has the `no_sanitize("kcfi")` attribute for this purpose, we would presumably just ignore the `nocf_check` attribute on pointers used for indirect calls when only KCFI is enabled, but preserve the semantics for assigning and casting the attributed pointers. How does the GCC KCFI implementation handle this? I would like to make sure both compilers behave the same way here.

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


More information about the llvm-commits mailing list