aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2019-06-03 23:20:30 +0200
committervan Hauser <vh@thc.org>2019-06-03 23:20:30 +0200
commit865212899a857f7afe96728d402db0de39ac7589 (patch)
tree143ad5ba824ea1ca21333cd31b5cc71c32fa84da
parentb3a504248f566e089175b5b42b0bd78c9148993a (diff)
downloadafl++-865212899a857f7afe96728d402db0de39ac7589.tar.gz
llvm support for up to version 8
-rw-r--r--docs/ChangeLog2
-rw-r--r--llvm_mode/Makefile18
-rw-r--r--llvm_mode/README.llvm4
-rw-r--r--llvm_mode/compare-transform-pass.so.cc8
4 files changed, 19 insertions, 13 deletions
diff --git a/docs/ChangeLog b/docs/ChangeLog
index 28042a47..e1d66767 100644
--- a/docs/ChangeLog
+++ b/docs/ChangeLog
@@ -27,7 +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 works with llvm 3.9 up to including 6.0.1
+ - llvm_mode works with llvm 3.9 up to including 8 !
- qemu_mode got upgraded from 2.1 to 3.1 - incorporated from
https://github.com/andreafioraldi/afl and with community patches added
diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile
index c9e04aa5..faa0e1a1 100644
--- a/llvm_mode/Makefile
+++ b/llvm_mode/Makefile
@@ -23,17 +23,17 @@ 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 )
+#LLVM_OK = $(shell $(LLVM_CONFIG) --version | egrep -q '^[5-6]' && echo 0 || echo 1 )
+LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version | egrep -q '^9' && echo 1 || echo 0 )
ifeq "$(LLVM_UNSUPPORTED)" "1"
- $(error llvm_mode only supports versions 3.9 up to 6.0.1 )
+ $(warn llvm_mode only supports versions 3.9 up to 8 )
endif
CFLAGS ?= -O3 -funroll-loops
CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign \
-DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
- -DVERSION=\"$(VERSION)\"
+ -DVERSION=\"$(VERSION)\"
ifdef AFL_TRACE_PC
CFLAGS += -DUSE_TRACE_PC=1
endif
@@ -42,7 +42,7 @@ CXXFLAGS ?= -O3 -funroll-loops
CXXFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign \
-DVERSION=\"$(VERSION)\" -Wno-variadic-macros
-CLANG_CFL = `$(LLVM_CONFIG) --cxxflags` -fno-rtti -fpic $(CXXFLAGS)
+CLANG_CFL = `$(LLVM_CONFIG) --cxxflags` -Wl,-znodelete -fno-rtti -fpic $(CXXFLAGS)
CLANG_LFL = `$(LLVM_CONFIG) --ldflags` $(LDFLAGS)
# User teor2345 reports that this is required to make things work on MacOS X.
@@ -57,11 +57,11 @@ endif
ifeq "$(origin CC)" "default"
CC = clang
- ifeq "$(LLVM_OK)" "1"
+# ifeq "$(LLVM_OK)" "1"
CXX = clang++
- else
- CXX = g++
- endif
+# else
+# CXX = g++
+# endif
endif
ifndef AFL_TRACE_PC
diff --git a/llvm_mode/README.llvm b/llvm_mode/README.llvm
index 3c152023..64fd8f44 100644
--- a/llvm_mode/README.llvm
+++ b/llvm_mode/README.llvm
@@ -7,8 +7,8 @@ Fast LLVM-based instrumentation for afl-fuzz
1) Introduction
---------------
-! llvm_mode works with verison 3.0 up to 6.0.1 !
-! llvm version 7, 8 and 9 do not work !
+! llvm_mode works with verison 3.9 up to 8 !
+! llvm version 9 does not work yet !
The code in this directory allows you to instrument programs for AFL using
true compiler-level instrumentation, instead of the more crude
diff --git a/llvm_mode/compare-transform-pass.so.cc b/llvm_mode/compare-transform-pass.so.cc
index 75c280f4..6652de0f 100644
--- a/llvm_mode/compare-transform-pass.so.cc
+++ b/llvm_mode/compare-transform-pass.so.cc
@@ -73,7 +73,13 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, const
IntegerType *Int8Ty = IntegerType::getInt8Ty(C);
IntegerType *Int32Ty = IntegerType::getInt32Ty(C);
IntegerType *Int64Ty = IntegerType::getInt64Ty(C);
- Constant* c = M.getOrInsertFunction("tolower",
+
+#if __clang_major__ < 9
+ Constant*
+#else
+ FunctionCallee
+#endif
+ c = M.getOrInsertFunction("tolower",
Int32Ty,
Int32Ty
#if __clang_major__ < 7