aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-18 15:27:35 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-02-18 15:27:35 +0100
commita83691d6626a4a3b4881534d5680153a5df2e951 (patch)
tree8d8ba3246dc6ee5f5d125bf44f2a1b1bb37d03b9
parent13296af49168c4b63f3d4ea1e31f278317114e5c (diff)
downloadafl++-a83691d6626a4a3b4881534d5680153a5df2e951.tar.gz
fix insertion of __cmplog_rtn_hook
-rw-r--r--llvm_mode/afl-clang-fast.c2
-rw-r--r--llvm_mode/cmplog-routines-pass.cc7
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index d9e2cd95..6e277c7e 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -208,6 +208,8 @@ static void edit_params(u32 argc, char** argv) {
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] =
alloc_printf("%s/cmplog-routines-pass.so", obj_path);
+
+ cc_params[cc_par_cnt++] = "-fno-inline";
} else {
diff --git a/llvm_mode/cmplog-routines-pass.cc b/llvm_mode/cmplog-routines-pass.cc
index 309ea65e..7e3acae2 100644
--- a/llvm_mode/cmplog-routines-pass.cc
+++ b/llvm_mode/cmplog-routines-pass.cc
@@ -280,9 +280,8 @@ bool CmpLogRoutines::hookRtns(Module &M) {
Value *v1P = callInst->getArgOperand(0),
*v2P = callInst->getArgOperand(1);
- BasicBlock *bb = callInst->getParent();
- BasicBlock::iterator IP = bb->getFirstInsertionPt();
- IRBuilder<> IRB(&*IP);
+ IRBuilder<> IRB(callInst->getParent());
+ IRB.SetInsertPoint(callInst);
std::vector<Value*> args;
args.push_back(v1P);
@@ -290,7 +289,7 @@ bool CmpLogRoutines::hookRtns(Module &M) {
IRB.CreateCall(cmplogHookFn, args, "tmp");
- errs() << callInst->getCalledFunction()->getName() << "\n";
+ // errs() << callInst->getCalledFunction()->getName() << "\n";
}