about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--llvm_mode/Makefile7
-rw-r--r--llvm_mode/afl-llvm-pass.so.cc2
2 files changed, 6 insertions, 3 deletions
diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile
index 6c55374b..202dcbc6 100644
--- a/llvm_mode/Makefile
+++ b/llvm_mode/Makefile
@@ -201,6 +201,8 @@ else
   TARGETS = test_shm test_deps $(PROGS) afl-clang-fast.8 test_build all_done
 endif
 
+LLVM_MIN_4_0_1 = $(shell awk 'BEGIN { exit ARGV[1] >= ARGV[2] }' $(LLVMVER) 4.0.1; echo $$?)
+
 all: $(TARGETS)
 
 ifeq "$(SHMAT_OK)" "1"
@@ -268,7 +270,10 @@ endif
 	-$(CXX) $(CLANG_CFL) -DLLVMInsTrim_EXPORTS -fno-rtti -fPIC -std=$(LLVM_STDCXX) -shared $< MarkNodes.cc -o $@ $(CLANG_LFL)
 
 ../afl-llvm-pass.so: afl-llvm-pass.so.cc | test_deps
-	$(CXX) $(CLANG_CFL) -DLLVMInsTrim_EXPORTS -Wno-#warnings -fno-rtti -fPIC -std=$(LLVM_STDCXX) -shared $< -o $@ $(CLANG_LFL)
+ifeq "$(LLVM_MIN_4_0_1)" "0"
+	$(info [!] N-gram branch coverage instrumentation is not available for llvm version $(LLVMVER))
+endif
+	$(CXX) $(CLANG_CFL) -DLLVMInsTrim_EXPORTS -fno-rtti -fPIC -std=$(LLVM_STDCXX) -shared $< -o $@ $(CLANG_LFL)
 
 ../afl-llvm-lto-whitelist.so: afl-llvm-lto-whitelist.so.cc
 ifeq "$(LLVM_LTO)" "1"
diff --git a/llvm_mode/afl-llvm-pass.so.cc b/llvm_mode/afl-llvm-pass.so.cc
index 05904f1a..8a75aa2d 100644
--- a/llvm_mode/afl-llvm-pass.so.cc
+++ b/llvm_mode/afl-llvm-pass.so.cc
@@ -153,8 +153,6 @@ uint64_t PowerOf2Ceil(unsigned in) {
 /* #if LLVM_VERSION_STRING >= "4.0.1" */
 #if LLVM_VERSION_MAJOR >= 4 || (LLVM_VERSION_MAJOR == 4 && LLVM_VERSION_PATCH >= 1)
 #define AFL_HAVE_VECTOR_INTRINSICS 1
-#else
-#warning this clang version does not have vector intrinsics -> no ngram instrumentation
 #endif
 bool AFLCoverage::runOnModule(Module &M) {