about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-07-05 13:03:17 +0200
committervanhauser-thc <vh@thc.org>2023-07-05 13:03:17 +0200
commitf37c4c86622c5e0ea10e0a0249e203c412c2db2e (patch)
tree07f56584f2939fa1c563d74c1f1811fded920ef8
parentda3351085519acf73dc8ddde3cf0b526b816551b (diff)
downloadafl++-f37c4c86622c5e0ea10e0a0249e203c412c2db2e.tar.gz
update llvm recommendations
-rw-r--r--GNUmakefile.llvm12
-rw-r--r--instrumentation/README.llvm.md2
-rw-r--r--src/afl-cc.c17
-rw-r--r--src/afl-fuzz.c2
4 files changed, 24 insertions, 9 deletions
diff --git a/GNUmakefile.llvm b/GNUmakefile.llvm
index 6ffac68f..f298060e 100644
--- a/GNUmakefile.llvm
+++ b/GNUmakefile.llvm
@@ -47,6 +47,7 @@ LLVM_MAJOR = $(shell $(LLVM_CONFIG) --version 2>/dev/null | sed 's/\..*//' )
 LLVM_MINOR = $(shell $(LLVM_CONFIG) --version 2>/dev/null | sed 's/.*\.//' | sed 's/git//' | sed 's/svn//' | sed 's/ .*//' )
 LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version 2>/dev/null | grep -E -q '^[0-2]\.|^3.[0-7]\.' && echo 1 || echo 0 )
 LLVM_TOO_NEW = $(shell $(LLVM_CONFIG) --version 2>/dev/null | grep -E -q '^1[7-9]' && echo 1 || echo 0 )
+LLVM_TOO_OLD = $(shell $(LLVM_CONFIG) --version 2>/dev/null | grep -E -q '^[1-9]\.|^1[012]\.' && echo 1 || echo 0 )
 LLVM_NEW_API = $(shell $(LLVM_CONFIG) --version 2>/dev/null | grep -E -q '^1[0-9]' && echo 1 || echo 0 )
 LLVM_NEWER_API = $(shell $(LLVM_CONFIG) --version 2>/dev/null | grep -E -q '^1[6-9]' && echo 1 || echo 0 )
 LLVM_13_OK = $(shell $(LLVM_CONFIG) --version 2>/dev/null | grep -E -q '^1[3-9]' && echo 1 || echo 0 )
@@ -69,6 +70,12 @@ ifeq "$(LLVM_TOO_NEW)" "1"
   $(warning you are using an in-development llvm version - this might break llvm_mode!)
 endif
 
+ifeq "$(LLVM_TOO_OLD)" "1"
+  $(warning you are using an outdated LLVM version! Please use at least LLVM 13 or newer!)
+  $(shell sleep 2)
+endif
+
+# No switching the meaning of LLVM_TOO_OLD
 LLVM_TOO_OLD=1
 
 ifeq "$(LLVM_MAJOR)" "9"
@@ -87,11 +94,6 @@ ifeq "$(LLVM_NEWER_API)" "1"
   LLVM_STDCXX = c++17
 endif
 
-ifeq "$(LLVM_TOO_OLD)" "1"
-  $(info [!] llvm_mode detected an old version of llvm, upgrade to at least 9 or preferable 11!)
-  $(shell sleep 1)
-endif
-
 ifeq "$(LLVM_HAVE_LTO)" "1"
   $(info [+] llvm_mode detected llvm 11+, enabling afl-lto LTO implementation)
   LLVM_LTO = 1
diff --git a/instrumentation/README.llvm.md b/instrumentation/README.llvm.md
index 126cf1a2..34b80c85 100644
--- a/instrumentation/README.llvm.md
+++ b/instrumentation/README.llvm.md
@@ -7,7 +7,7 @@ For the GCC-based instrumentation, see
 
 ## 1) Introduction
 
-! llvm_mode works with llvm versions 3.8 up to 13 !
+! llvm_mode works with llvm versions 3.8 up to 17 - but 13+ is recommended !
 
 The code in this directory allows you to instrument programs for AFL++ using
 true compiler-level instrumentation, instead of the more crude assembly-level
diff --git a/src/afl-cc.c b/src/afl-cc.c
index ec460f17..86b81459 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -384,12 +384,16 @@ static u8 fortify_set = 0, asan_set = 0, x_set = 0, bit_mode = 0,
           non_dash = 0;
 
 #ifndef MAX_PARAMS_NUM
-#define MAX_PARAMS_NUM 2048
+  #define MAX_PARAMS_NUM 2048
 #endif
 
 static void process_params(u32 argc, char **argv) {
 
-  if (cc_par_cnt + argc >= MAX_PARAMS_NUM) { FATAL("Too many command line parameters, please increase MAX_PARAMS_NUM."); }
+  if (cc_par_cnt + argc >= MAX_PARAMS_NUM) {
+
+    FATAL("Too many command line parameters, please increase MAX_PARAMS_NUM.");
+
+  }
 
   if (lto_mode && argc > 1) {
 
@@ -2350,6 +2354,15 @@ int main(int argc, char **argv, char **envp) {
         "AFL_LLVM_CMPLOG and "
         "AFL_LLVM_DICT2FILE+AFL_LLVM_DICT2FILE_NO_MAIN.\n\n");
 
+    if (LLVM_MAJOR < 13) {
+
+      SAYF(
+          "Warning: It is highly recommended to use at least LLVM version 13 "
+          "(or better, higher) rather than %d!\n\n",
+          LLVM_MAJOR);
+
+    }
+
     exit(1);
 
   }
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 70258e33..9afece66 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -1283,7 +1283,7 @@ int main(int argc, char **argv_orig, char **envp) {
 
         WARNF(
             "Note that the MOpt mode is not maintained and is not as effective "
-            "normal havoc mode.");
+            "as normal havoc mode.");
 
       } break;