about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--docs/ChangeLog3
-rw-r--r--docs/README2
-rw-r--r--llvm_mode/Makefile13
-rw-r--r--llvm_mode/README.llvm5
4 files changed, 15 insertions, 8 deletions
diff --git a/docs/ChangeLog b/docs/ChangeLog
index 620623a2..0393e8c3 100644
--- a/docs/ChangeLog
+++ b/docs/ChangeLog
@@ -27,8 +27,7 @@ Version ++2.52c (2019-05-28):
     to the AFL schedule, not to the FAST schedule. So nothing changes unless
     you use the new -p option :-) - see docs/power_schedules.txt
   - added afl-system-config script to set all system performance options for fuzzing
-  - llvm_mode is currently configured to work with llvm 5.0 and 6.0.
-    To compile with 3.9 or 4.0 you must change CXX to clang++ in llvm_mode/Makefile
+  - llvm_mode works with llvm 3.9 up to including 6.0.1
 
 
 ---------------------------
diff --git a/docs/README b/docs/README
index 2351f3ae..9279a361 100644
--- a/docs/README
+++ b/docs/README
@@ -119,7 +119,7 @@ The clang wrappers (afl-clang and afl-clang++) can be used in the same way;
 clang users may also opt to leverage a higher-performance instrumentation mode,
 as described in llvm_mode/README.llvm.
 Clang/LLVM has a much better performance, but only works with LLVM up to and
-including 6.0.
+including 6.0.1.
 Using the LAF Intel performance enhancements are also recommended, see 
 docs/README.laf-intel
 
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