[clang] [clang] Function type attribute to prevent CFI instrumentation (PR #135836)
Bruno De Fraine via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 24 02:57:50 PDT 2025
================
@@ -9283,8 +9283,14 @@ static AssignConvertType checkPointerTypesForAssignment(Sema &S,
return AssignConvertType::IncompatibleFunctionPointer;
return AssignConvertType::IncompatiblePointer;
}
- if (!S.getLangOpts().CPlusPlus && S.IsFunctionConversion(ltrans, rtrans))
- return AssignConvertType::IncompatibleFunctionPointer;
+ bool DiscardingCFIUncheckedCallee, AddingCFIUncheckedCallee;
+ if (!S.getLangOpts().CPlusPlus &&
+ S.IsFunctionConversion(ltrans, rtrans, &DiscardingCFIUncheckedCallee,
+ &AddingCFIUncheckedCallee)) {
+ // Allow conversions between CFIUncheckedCallee-ness.
+ if (!DiscardingCFIUncheckedCallee && !AddingCFIUncheckedCallee)
+ return AssignConvertType::IncompatibleFunctionPointer;
+ }
----------------
brunodf-snps wrote:
Follow up in #160474 and #160477, please review.
https://github.com/llvm/llvm-project/pull/135836
More information about the cfe-commits
mailing list