about summary refs log tree commit diff
path: root/llvm_mode
diff options
context:
space:
mode:
Diffstat (limited to 'llvm_mode')
-rw-r--r--llvm_mode/Makefile13
-rw-r--r--llvm_mode/README.llvm5
2 files changed, 13 insertions, 5 deletions
diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile
index 100d57f5..c9e04aa5 100644
--- a/llvm_mode/Makefile
+++ b/llvm_mode/Makefile
@@ -23,6 +23,12 @@ BIN_PATH     = $(PREFIX)/bin
 VERSION     = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2)
 
 LLVM_CONFIG ?= llvm-config
+LLVM_OK = $(shell $(LLVM_CONFIG) --version | egrep -q '^[5-6]' && echo 0 || echo 1 )
+LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version | egrep -q '^[7-9]' && echo 1 || echo 0 )
+
+ifeq "$(LLVM_UNSUPPORTED)" "1"
+  $(error llvm_mode only supports versions 3.9 up to 6.0.1 )
+endif
 
 CFLAGS      ?= -O3 -funroll-loops
 CFLAGS      += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign \
@@ -51,8 +57,11 @@ endif
 
 ifeq "$(origin CC)" "default"
   CC         = clang
-  # if you use llvm 3.9 or 4.0 switch this to clang++ below
-  CXX        = g++
+  ifeq "$(LLVM_OK)" "1"
+    CXX        = clang++
+  else
+    CXX        = g++
+  endif
 endif
 
 ifndef AFL_TRACE_PC
diff --git a/llvm_mode/README.llvm b/llvm_mode/README.llvm
index c6d21783..3c152023 100644
--- a/llvm_mode/README.llvm
+++ b/llvm_mode/README.llvm
@@ -7,9 +7,8 @@ Fast LLVM-based instrumentation for afl-fuzz
 1) Introduction
 ---------------
 
-! llvm_mode is currently configured to compile with llvm 5.0 and 6.0 via g++ !
-! To compile with llvm 3.9 and 4.0 edit the Makefile and change CXX to clang++ !
-! Fixes for llvm 3.7, 7 and 8 are in the work !
+! llvm_mode works with verison 3.0 up to 6.0.1 !
+! llvm version 7, 8 and 9 do not work !
 
 The code in this directory allows you to instrument programs for AFL using
 true compiler-level instrumentation, instead of the more crude