about summary refs log tree commit diff
path: root/llvm_mode/cmplog-routines-pass.cc
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-29 14:35:05 +0200
committerGitHub <noreply@github.com>2020-05-29 14:35:05 +0200
commit710dda522186310a7fb4e3b6a05cae0b28fa619e (patch)
treef96fcfe756fe5e6e0dde11be8df8b3df9f654952 /llvm_mode/cmplog-routines-pass.cc
parent6892018142cc21ba9a0744c0757d39f21e9b66bc (diff)
parentc3b864d8d4dfaf148158a689df0c5ddf4bcc1f32 (diff)
downloadafl++-710dda522186310a7fb4e3b6a05cae0b28fa619e.tar.gz
Merge pull request #374 from AFLplusplus/dev
Dev
Diffstat (limited to 'llvm_mode/cmplog-routines-pass.cc')
-rw-r--r--llvm_mode/cmplog-routines-pass.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm_mode/cmplog-routines-pass.cc b/llvm_mode/cmplog-routines-pass.cc
index bb78273a..e05a1843 100644
--- a/llvm_mode/cmplog-routines-pass.cc
+++ b/llvm_mode/cmplog-routines-pass.cc
@@ -93,16 +93,17 @@ bool CmpLogRoutines::hookRtns(Module &M) {
   std::vector<CallInst *> calls;
   LLVMContext &           C = M.getContext();
 
-  Type *       VoidTy = Type::getVoidTy(C);
-  PointerType *VoidPtrTy = PointerType::get(VoidTy, 0);
+  Type *VoidTy = Type::getVoidTy(C);
+  // PointerType *VoidPtrTy = PointerType::get(VoidTy, 0);
+  IntegerType *Int8Ty = IntegerType::getInt8Ty(C);
+  PointerType *i8PtrTy = PointerType::get(Int8Ty, 0);
 
 #if LLVM_VERSION_MAJOR < 9
   Constant *
 #else
   FunctionCallee
 #endif
-      c = M.getOrInsertFunction("__cmplog_rtn_hook", VoidTy, VoidPtrTy,
-                                VoidPtrTy
+      c = M.getOrInsertFunction("__cmplog_rtn_hook", VoidTy, i8PtrTy, i8PtrTy
 #if LLVM_VERSION_MAJOR < 5
                                 ,
                                 NULL
@@ -163,8 +164,10 @@ bool CmpLogRoutines::hookRtns(Module &M) {
     IRB.SetInsertPoint(callInst);
 
     std::vector<Value *> args;
-    args.push_back(v1P);
-    args.push_back(v2P);
+    Value *              v1Pcasted = IRB.CreatePointerCast(v1P, i8PtrTy);
+    Value *              v2Pcasted = IRB.CreatePointerCast(v2P, i8PtrTy);
+    args.push_back(v1Pcasted);
+    args.push_back(v2Pcasted);
 
     IRB.CreateCall(cmplogHookFn, args, "tmp");