[clang] [llvm] [X86] Extend kCFI with a 3-bit arity indicator (PR #121070)

Sami Tolvanen via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 15:30:45 PST 2025


================
@@ -254,6 +254,7 @@ FEATURE(is_trivially_constructible, LangOpts.CPlusPlus)
 FEATURE(is_trivially_copyable, LangOpts.CPlusPlus)
 FEATURE(is_union, LangOpts.CPlusPlus)
 FEATURE(kcfi, LangOpts.Sanitize.has(SanitizerKind::KCFI))
+FEATURE(kcfi_x86_arity, LangOpts.Sanitize.has(SanitizerKind::KCFI))
----------------
samitolvanen wrote:

Encoding arity information in the register argument solves the hash compatibility issue, so I definitely prefer this approach over https://github.com/llvm/llvm-project/pull/117121. As you noted, the FineIBT patching code still needs to know whether both compilers emit arity information, and while using `__has_feature` in C should be sufficient, how would the rustc feature test look like? A quick search didn't find any Kconfig examples for this. I assume we would need a Kconfig variable to pass this information to C code, but perhaps there are better options?

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


More information about the llvm-commits mailing list