Skip to content

Commit 646754d

Browse files
authored
[llvm] When CFI check is disabled, do not check KCFI.
1 parent f7610b8 commit 646754d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3564,6 +3564,16 @@ void Verifier::visitCallBase(CallBase &Call) {
35643564
Check(BU.Inputs[1]->getType()->isIntegerTy(64),
35653565
"Ptrauth bundle discriminator operand must be an i64", Call);
35663566
} else if (Tag == LLVMContext::OB_kcfi) {
3567+
// If the call has a grandparent and is associated with a module that has
3568+
// the "Disable CFI Check" flag,
3569+
// skip further processing for this call.
3570+
if (Call.getParent() && Call.getParent()->getParent() &&
3571+
Call.getModule()) {
3572+
if (Call.getModule()->getModuleFlag("Disable CFI Check")) {
3573+
continue;
3574+
}
3575+
}
3576+
35673577
Check(!FoundKCFIBundle, "Multiple kcfi operand bundles", Call);
35683578
FoundKCFIBundle = true;
35693579
Check(BU.Inputs.size() == 1, "Expected exactly one kcfi bundle operand",

0 commit comments

Comments
 (0)