[clang] fix kcfi doesn't take effect when callee function has no input parameter (PR #106677)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 30 00:23:27 PDT 2024
https://github.com/Zhenhang1213 created https://github.com/llvm/llvm-project/pull/106677
fix #106344
>From 3707b69ebd14be7fb8a88a5550639d1af1948ba6 Mon Sep 17 00:00:00 2001
From: Austin <zhenhangwang at huawei.com>
Date: Fri, 30 Aug 2024 15:21:12 +0800
Subject: [PATCH] fix kcfi doesn't take effect when callee function has no
input parameter
---
clang/lib/CodeGen/CodeGenFunction.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index c89eaa0f4e3bfc..4d3fb780243022 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -2813,6 +2813,11 @@ void CodeGenFunction::EmitKCFIOperandBundle(
Callee.getAbstractInfo().getCalleeFunctionProtoType();
if (FP)
Bundles.emplace_back("kcfi", CGM.CreateKCFITypeId(FP->desugar()));
+ else {
+ ASTContext &context = this->getContext();
+ QualType voidType = context.VoidTy;
+ Bundles.emplace_back("kcfi", CGM.CreateKCFITypeId(voidType));
+ }
}
llvm::Value *CodeGenFunction::FormAArch64ResolverCondition(
More information about the cfe-commits
mailing list