diff options
author | David Carlier <devnexen@gmail.com> | 2019-12-02 13:15:01 +0000 |
---|---|---|
committer | David Carlier <devnexen@gmail.com> | 2019-12-02 14:26:29 +0000 |
commit | b0d590fef4acb4b002429e4aec195e5740122494 (patch) | |
tree | ab6a4383182cac0e68794f786178b1c2fb30395d | |
parent | 25b435060c399665bb54937664b90c11bef6dd2a (diff) | |
download | afl++-b0d590fef4acb4b002429e4aec195e5740122494.tar.gz |
LLVM 10 build fix proposal
c++14 is the minimum for this version, thus the hardcoded gnu++11 standard flag makes the build fails. Missing header only for this version seemingly for the option.
-rw-r--r-- | llvm_mode/LLVMInsTrim.so.cc | 1 | ||||
-rw-r--r-- | llvm_mode/Makefile | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/llvm_mode/LLVMInsTrim.so.cc b/llvm_mode/LLVMInsTrim.so.cc index f723a0fe..1d4e6f2f 100644 --- a/llvm_mode/LLVMInsTrim.so.cc +++ b/llvm_mode/LLVMInsTrim.so.cc @@ -13,6 +13,7 @@ #include "llvm/IR/Module.h" #include "llvm/Pass.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/IR/DebugInfo.h" diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 033babac..1f68e517 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -37,8 +37,10 @@ endif LLVMVER = $(shell $(LLVM_CONFIG) --version 2>/dev/null) LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^[12]|^3\.0|^1[0-9]' && echo 1 || echo 0 ) +LLVM_NEW_API = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^1[0-9]' && echo 1 || echo 0 ) LLVM_MAJOR = $(shell $(LLVM_CONFIG) --version 2>/dev/null | sed 's/\..*//') LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null) +LLVM_STDCXX = gnu++11 ifeq "$(LLVM_UNSUPPORTED)" "1" $(warn llvm_mode only supports versions 3.8.0 up to 9) @@ -49,6 +51,10 @@ ifeq "$(LLVM_MAJOR)" "9" $(info llvm_mode detected llvm 9, enabling neverZero implementation) endif +ifeq "$(LLVM_NEW_API)" "1" + LLVM_STDCXX = c++14 +endif + CFLAGS ?= -O3 -funroll-loops CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -I ../include/ \ -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \ @@ -167,10 +173,10 @@ endif ln -sf afl-clang-fast ../afl-clang-fast++ ../libLLVMInsTrim.so: LLVMInsTrim.so.cc MarkNodes.cc | test_deps - $(CXX) $(CLANG_CFL) -DLLVMInsTrim_EXPORTS -fno-rtti -fPIC -std=gnu++11 -shared $< MarkNodes.cc -o $@ $(CLANG_LFL) + $(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 -fno-rtti -fPIC -std=gnu++11 -shared $< -o $@ $(CLANG_LFL) + $(CXX) $(CLANG_CFL) -DLLVMInsTrim_EXPORTS -fno-rtti -fPIC -std=$(LLVM_STDCXX) -shared $< -o $@ $(CLANG_LFL) # laf ../split-switches-pass.so: split-switches-pass.so.cc | test_deps |