about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2019-06-02 22:23:25 +0200
committervan Hauser <vh@thc.org>2019-06-02 22:23:25 +0200
commit49a08e38b9afd4506e7efd191533884abe803939 (patch)
treeea444e9cc1f2892f55ff1f0e3ea71c2eea777e2f
parentc9d2c5f26925f7b442fe8b8e92ced6bfdb6944d3 (diff)
downloadafl++-49a08e38b9afd4506e7efd191533884abe803939.tar.gz
llvm 5.0 and 6.0 workaround
-rw-r--r--llvm_mode/Makefile2
-rw-r--r--llvm_mode/afl-clang-fast.c10
-rw-r--r--llvm_mode/compare-transform-pass.so.cc6
-rw-r--r--llvm_mode/split-compares-pass.so.cc4
-rw-r--r--llvm_mode/split-switches-pass.so.cc10
5 files changed, 29 insertions, 3 deletions
diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile
index 13a53463..ec417e2e 100644
--- a/llvm_mode/Makefile
+++ b/llvm_mode/Makefile
@@ -51,7 +51,7 @@ endif
 
 ifeq "$(origin CC)" "default"
   CC         = clang
-  CXX        = clang++
+  CXX        = g++
 endif
 
 ifndef AFL_TRACE_PC
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index 8aef68ef..73e8ec57 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/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]);
diff --git a/llvm_mode/compare-transform-pass.so.cc b/llvm_mode/compare-transform-pass.so.cc
index 5b3494af..75c280f4 100644
--- a/llvm_mode/compare-transform-pass.so.cc
+++ b/llvm_mode/compare-transform-pass.so.cc
@@ -45,8 +45,12 @@ 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
diff --git a/llvm_mode/split-compares-pass.so.cc b/llvm_mode/split-compares-pass.so.cc
index 5bd01d62..ae6a2d52 100644
--- a/llvm_mode/split-compares-pass.so.cc
+++ b/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";
       }
diff --git a/llvm_mode/split-switches-pass.so.cc b/llvm_mode/split-switches-pass.so.cc
index 1341c7f9..12be8a95 100644
--- a/llvm_mode/split-switches-pass.so.cc
+++ b/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,8 +258,12 @@ 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