llvm 5.0 and 6.0 workaround
MODIFY
llvm_mode/Makefile
llvm_mode/Makefile
@@ -51,7 +51,7 @@ endif
ifeq "$(origin CC)" "default"
CC = clang
- CXX = clang++
+ CXX = g++
endif
ifndef AFL_TRACE_PC

MODIFY
llvm_mode/afl-clang-fast.c
llvm_mode/afl-clang-fast.c
@@ -296,6 +296,8 @@ static void edit_params(u32 argc, char** argv) {
if (maybe_linking) {
+ cc_params[cc_par_cnt++] = "-Wl,-znodelete";
+
if (x_set) {
cc_params[cc_par_cnt++] = "-x";
cc_params[cc_par_cnt++] = "none";
@@ -372,6 +374,14 @@ int main(int argc, char** argv) {
edit_params(argc, argv);
+/*
+ int i = 0;
+ printf("EXEC:");
+ while (cc_params[i] != NULL)
+ printf(" %s", cc_params[i++]);
+ printf("\n");
+*/
+
execvp(cc_params[0], (char**)cc_params);
FATAL("Oops, failed to execute '%s' - check your PATH", cc_params[0]);

MODIFY
llvm_mode/compare-transform-pass.so.cc
llvm_mode/compare-transform-pass.so.cc
@@ -45,10 +45,14 @@ namespace {
bool runOnModule(Module &M) override;
-#if __clang_major__ < 4
+#if (__clang_major__ < 4)
+ #ifndef __GNUG__
const char * getPassName() const override {
#else
StringRef getPassName() const override {
+ #endif
+#else
+ StringRef getPassName() const override {
#endif
return "transforms compare functions";
}

MODIFY
llvm_mode/split-compares-pass.so.cc
llvm_mode/split-compares-pass.so.cc
@@ -36,7 +36,11 @@ namespace {
#if __clang_major__ >= 4
StringRef getPassName() const override {
#else
+ #ifndef __GNUG__
const char * getPassName() const override {
+ #else
+ StringRef getPassName() const override {
+ #endif
#endif
return "simplifies and splits ICMP instructions";
}

MODIFY
llvm_mode/split-switches-pass.so.cc
llvm_mode/split-switches-pass.so.cc
@@ -48,7 +48,11 @@ namespace {
#if __clang_major__ >= 4
StringRef getPassName() const override {
#else
+ #ifndef __GNUG__
const char * getPassName() const override {
+ #else
+ StringRef getPassName() const override {
+ #endif
#endif
return "splits switch constructs";
}
@@ -254,10 +258,14 @@ bool SplitSwitchesTransform::splitSwitches(Module &M) {
/* Prepare cases vector. */
CaseVector Cases;
for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end(); i != e; ++i)
-#if __clang_major__ < 7
+#if __clang_major__ < 5
+ #ifndef __GNUG__
Cases.push_back(CaseExpr(i.getCaseValue(), i.getCaseSuccessor()));
#else
Cases.push_back(CaseExpr(i->getCaseValue(), i->getCaseSuccessor()));
+ #endif
+#else
+ Cases.push_back(CaseExpr(i->getCaseValue(), i->getCaseSuccessor()));
#endif
std::vector<bool> bytesChecked(Cases[0].Val->getBitWidth() / 8, false);
BasicBlock* SwitchBlock = switchConvert(Cases, bytesChecked, OrigBlock, NewDefault, Val, 0);

llvm 5.0 and 6.0 workaround