Fix AFLCoverage Pass & small fixes (#678)
* fix * more * declare LIBAFL_CC_LLVM_VERSION at least when no llvm-config found * More llvm14 fixes
This commit is contained in:
parent
5fd63c0076
commit
49de0046e8
@ -248,6 +248,8 @@ fn main() {
|
||||
pub const CLANG_PATH: &str = \"clang\";
|
||||
/// The path to the `clang++` executable
|
||||
pub const CLANGXX_PATH: &str = \"clang++\";
|
||||
/// The llvm version used to build llvm passes
|
||||
pub const LIBAFL_CC_LLVM_VERSION: Option<usize> = None;
|
||||
"
|
||||
)
|
||||
.expect("Could not write file");
|
||||
|
@ -51,6 +51,11 @@
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/Support/FormatVariadic.h"
|
||||
|
||||
// Without this, Can't build with llvm-14 & old PM
|
||||
#if LLVM_VERSION_MAJOR >= 14 && !defined(USE_NEW_PM)
|
||||
#include "llvm/Pass.h"
|
||||
#endif
|
||||
|
||||
#if LLVM_VERSION_MAJOR > 3 || \
|
||||
(LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
@ -593,11 +598,21 @@ bool AFLCoverage::runOnModule(Module &M) {
|
||||
|
||||
/* Load prev_loc */
|
||||
|
||||
LoadInst *PrevLoc = IRB.CreateLoad(
|
||||
LoadInst *PrevLoc;
|
||||
|
||||
if (Ngram) {
|
||||
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;
|
||||
|
||||
|
@ -41,6 +41,11 @@
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
|
||||
// Without this, Can't build with llvm-14 & old PM
|
||||
#if LLVM_VERSION_MAJOR >= 14 && !defined(USE_NEW_PM)
|
||||
#include "llvm/Pass.h"
|
||||
#endif
|
||||
|
||||
#if LLVM_VERSION_MAJOR > 3 || \
|
||||
(LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user