mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-17 12:18:08 +00:00
llvm_mode: lower llvm version reqs to 3.4 (LLInsTrim will not be
available)
This commit is contained in:
@ -39,7 +39,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
LLVMVER = $(shell $(LLVM_CONFIG) --version 2>/dev/null | sed 's/git//' )
|
LLVMVER = $(shell $(LLVM_CONFIG) --version 2>/dev/null | sed 's/git//' )
|
||||||
LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^3\.[0-7]|^1[2-9]' && echo 1 || echo 0 )
|
LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^3\.[0-3]|^1[2-9]' && echo 1 || echo 0 )
|
||||||
LLVM_NEW_API = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^1[0-9]' && echo 1 || echo 0 )
|
LLVM_NEW_API = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^1[0-9]' && echo 1 || echo 0 )
|
||||||
LLVM_MAJOR = $(shell $(LLVM_CONFIG) --version 2>/dev/null | sed 's/\..*//')
|
LLVM_MAJOR = $(shell $(LLVM_CONFIG) --version 2>/dev/null | sed 's/\..*//')
|
||||||
LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null)
|
LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null)
|
||||||
|
@ -160,9 +160,21 @@ struct InsTrim : public ModulePass {
|
|||||||
else
|
else
|
||||||
#else
|
#else
|
||||||
if (ngram_size_str)
|
if (ngram_size_str)
|
||||||
|
#ifdef LLVM_VERSION_STRING
|
||||||
FATAL(
|
FATAL(
|
||||||
"Sorry, NGRAM branch coverage is not supported with llvm version %s!",
|
"Sorry, NGRAM branch coverage is not supported with llvm version %s!",
|
||||||
LLVM_VERSION_STRING);
|
LLVM_VERSION_STRING);
|
||||||
|
#else
|
||||||
|
#ifndef LLVM_VERSION_PATCH
|
||||||
|
FATAL(
|
||||||
|
"Sorry, NGRAM branch coverage is not supported with llvm version %d.%d.%d!",
|
||||||
|
LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, 0);
|
||||||
|
#else
|
||||||
|
FATAL(
|
||||||
|
"Sorry, NGRAM branch coverage is not supported with llvm version %d.%d.%d!",
|
||||||
|
LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, LLVM_VERISON_PATCH);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
PrevLocSize = 1;
|
PrevLocSize = 1;
|
||||||
|
|
||||||
|
@ -33,7 +33,10 @@ char *getBBName(const llvm::BasicBlock *BB) {
|
|||||||
std::string Str;
|
std::string Str;
|
||||||
raw_string_ostream OS(Str);
|
raw_string_ostream OS(Str);
|
||||||
|
|
||||||
|
#if LLVM_VERSION_MAJOR >= 4 || \
|
||||||
|
(LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7)
|
||||||
BB->printAsOperand(OS, false);
|
BB->printAsOperand(OS, false);
|
||||||
|
#endif
|
||||||
name = strdup(OS.str().c_str());
|
name = strdup(OS.str().c_str());
|
||||||
return name;
|
return name;
|
||||||
|
|
||||||
@ -171,7 +174,7 @@ bool isInWhitelist(llvm::Function *F) {
|
|||||||
#else
|
#else
|
||||||
if (!Loc.isUnknown()) {
|
if (!Loc.isUnknown()) {
|
||||||
|
|
||||||
DILocation cDILoc(Loc.getAsMDNode(C));
|
DILocation cDILoc(Loc.getAsMDNode(F->getContext()));
|
||||||
|
|
||||||
unsigned int instLine = cDILoc.getLineNumber();
|
unsigned int instLine = cDILoc.getLineNumber();
|
||||||
StringRef instFilename = cDILoc.getFilename();
|
StringRef instFilename = cDILoc.getFilename();
|
||||||
|
@ -211,8 +211,15 @@ bool AFLCoverage::runOnModule(Module &M) {
|
|||||||
else
|
else
|
||||||
#else
|
#else
|
||||||
if (ngram_size_str)
|
if (ngram_size_str)
|
||||||
FATAL("Sorry, NGRAM branch coverage is not supported with llvm version %s!",
|
#ifndef LLVM_VERSION_PATCH
|
||||||
LLVM_VERSION_STRING);
|
FATAL("Sorry, NGRAM branch coverage is not supported with llvm version %d.%d.%d!",
|
||||||
|
LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR,
|
||||||
|
0);
|
||||||
|
#else
|
||||||
|
FATAL("Sorry, NGRAM branch coverage is not supported with llvm version %d.%d.%d!",
|
||||||
|
LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR,
|
||||||
|
LLVM_VERSION_PATCH);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
PrevLocSize = 1;
|
PrevLocSize = 1;
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include "llvm/Config/llvm-config.h"
|
#include "llvm/Config/llvm-config.h"
|
||||||
|
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/IR/DebugInfo.h"
|
|
||||||
#include "llvm/IR/IRBuilder.h"
|
#include "llvm/IR/IRBuilder.h"
|
||||||
#include "llvm/IR/LegacyPassManager.h"
|
#include "llvm/IR/LegacyPassManager.h"
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "llvm/Config/llvm-config.h"
|
#include "llvm/Config/llvm-config.h"
|
||||||
|
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/IR/DebugInfo.h"
|
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/IR/LegacyPassManager.h"
|
#include "llvm/IR/LegacyPassManager.h"
|
||||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
|
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "llvm/Config/llvm-config.h"
|
#include "llvm/Config/llvm-config.h"
|
||||||
|
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/IR/DebugInfo.h"
|
|
||||||
#include "llvm/IR/IRBuilder.h"
|
#include "llvm/IR/IRBuilder.h"
|
||||||
#include "llvm/IR/LegacyPassManager.h"
|
#include "llvm/IR/LegacyPassManager.h"
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
|
@ -338,6 +338,7 @@ test -e ../afl-clang-fast -a -e ../split-switches-pass.so && {
|
|||||||
rm -f test-instr.plain
|
rm -f test-instr.plain
|
||||||
|
|
||||||
# now for the special llvm_mode things
|
# now for the special llvm_mode things
|
||||||
|
test -e ../libLLVMInsTrim.so && {
|
||||||
AFL_LLVM_INSTRIM=1 AFL_LLVM_INSTRIM_LOOPHEAD=1 ../afl-clang-fast -o test-instr.instrim ../test-instr.c > /dev/null 2>test.out
|
AFL_LLVM_INSTRIM=1 AFL_LLVM_INSTRIM_LOOPHEAD=1 ../afl-clang-fast -o test-instr.instrim ../test-instr.c > /dev/null 2>test.out
|
||||||
test -e test-instr.instrim && {
|
test -e test-instr.instrim && {
|
||||||
TUPLES=`echo 0|../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-instr.instrim 2>&1 | grep Captur | awk '{print$3}'`
|
TUPLES=`echo 0|../afl-showmap -m ${MEM_LIMIT} -o /dev/null -- ./test-instr.instrim 2>&1 | grep Captur | awk '{print$3}'`
|
||||||
@ -352,6 +353,10 @@ test -e ../afl-clang-fast -a -e ../split-switches-pass.so && {
|
|||||||
$ECHO "$RED[!] llvm_mode InsTrim compilation failed"
|
$ECHO "$RED[!] llvm_mode InsTrim compilation failed"
|
||||||
CODE=1
|
CODE=1
|
||||||
}
|
}
|
||||||
|
} || {
|
||||||
|
$ECHO "$YELLOW[-] llvm_mode InsTrim not compiled, cannot test"
|
||||||
|
INCOMPLETE=1
|
||||||
|
}
|
||||||
AFL_DEBUG=1 AFL_LLVM_LAF_SPLIT_SWITCHES=1 AFL_LLVM_LAF_TRANSFORM_COMPARES=1 AFL_LLVM_LAF_SPLIT_COMPARES=1 ../afl-clang-fast -o test-compcov.compcov test-compcov.c > test.out 2>&1
|
AFL_DEBUG=1 AFL_LLVM_LAF_SPLIT_SWITCHES=1 AFL_LLVM_LAF_TRANSFORM_COMPARES=1 AFL_LLVM_LAF_SPLIT_COMPARES=1 ../afl-clang-fast -o test-compcov.compcov test-compcov.c > test.out 2>&1
|
||||||
test -e test-compcov.compcov && {
|
test -e test-compcov.compcov && {
|
||||||
grep --binary-files=text -Eq " [ 12][0-9][0-9] location| [3-9][0-9] location" test.out && {
|
grep --binary-files=text -Eq " [ 12][0-9][0-9] location| [3-9][0-9] location" test.out && {
|
||||||
|
Reference in New Issue
Block a user