[clang] [Clang][attr] Add 'kcfi_salt' attribute (PR #141846)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 31 14:48:54 PDT 2025


================
@@ -3929,6 +3929,14 @@ def CFICanonicalJumpTable : InheritableAttr {
   let SimpleHandler = 1;
 }
 
+def CFISalt : DeclOrTypeAttr {
+  let Spellings = [Clang<"cfi_salt">];
+  let Args = [StringArgument<"Salt">];
+  let Subjects = SubjectList<[Function, Field, Var, TypedefName], ErrorDiag>;
----------------
bwendling wrote:

> With your latest changes to use `TypeAttr`, that will never apply to a declaration and so I think the `Subjects` list should be `FunctionLike` (only) because it applies to either function types or function pointer types.

That limits some uses. @kees, is it okay to abandon these constructs?

```
typedef int (*fp_t)(void);

struct foo {
  fp_t __cfi_salt func;
};

void bar(fp_t __cfi_salt func) {}
```

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


More information about the cfe-commits mailing list