llvm compile fix
MODIFY
docs/ChangeLog
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
---------------------------

MODIFY
docs/README
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

MODIFY
llvm_mode/Makefile
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,9 +57,12 @@ endif
ifeq "$(origin CC)" "default"
CC = clang
- # if you use llvm 3.9 or 4.0 switch this to clang++ below
+ ifeq "$(LLVM_OK)" "1"
+ CXX = clang++
+ else
CXX = g++
endif
+endif
ifndef AFL_TRACE_PC
PROGS = ../afl-clang-fast ../afl-llvm-pass.so ../afl-llvm-rt.o ../afl-llvm-rt-32.o ../afl-llvm-rt-64.o ../compare-transform-pass.so ../split-compares-pass.so ../split-switches-pass.so

MODIFY
llvm_mode/README.llvm
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

llvm compile fix