From ee10461f48c441ee89c8003828969381f5c21205 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Thu, 16 Dec 2021 01:44:50 +0100 Subject: fix llvm 14 changes for ctx and ngram --- instrumentation/afl-llvm-pass.so.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'instrumentation/afl-llvm-pass.so.cc') diff --git a/instrumentation/afl-llvm-pass.so.cc b/instrumentation/afl-llvm-pass.so.cc index be0bcbc8..18c0294e 100644 --- a/instrumentation/afl-llvm-pass.so.cc +++ b/instrumentation/afl-llvm-pass.so.cc @@ -456,7 +456,7 @@ bool AFLCoverage::runOnModule(Module &M) { PrevCaller = IRB.CreateLoad( #if LLVM_VERSION_MAJOR >= 14 - IRB.getInt32Ty(), + PrevCallerTy, #endif AFLPrevCaller); PrevCaller->setMetadata(M.getMDKindID("nosanitize"), @@ -628,11 +628,21 @@ bool AFLCoverage::runOnModule(Module &M) { /* Load prev_loc */ - LoadInst *PrevLoc = IRB.CreateLoad( + LoadInst *PrevLoc; + + if (ngram_size) { + PrevLoc = IRB.CreateLoad( +#if LLVM_VERSION_MAJOR >= 14 + PrevLocTy, +#endif + AFLPrevLoc); + } else { + PrevLoc = IRB.CreateLoad( #if LLVM_VERSION_MAJOR >= 14 IRB.getInt32Ty(), #endif AFLPrevLoc); + } PrevLoc->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None)); Value *PrevLocTrans; -- cgit 1.4.1