about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-06-16 15:59:09 +0200
committervan Hauser <vh@thc.org>2020-06-16 15:59:09 +0200
commite5dcaa818e58eaa48c58865ae9f623c5a44989d7 (patch)
tree1c74f2f134a094d6aa23aa389d81c6959efe36cf
parentbac2da866912d69eb89207757375f0753be2cae2 (diff)
downloadafl++-e5dcaa818e58eaa48c58865ae9f623c5a44989d7.tar.gz
set class afl instrumentation if llvm <= 6
-rw-r--r--docs/Changelog.md8
-rw-r--r--llvm_mode/afl-clang-fast.c12
2 files changed, 11 insertions, 9 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 21f79cda..efc18ab5 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -24,10 +24,10 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
      - fix/update to MOpt (thanks to arnow117)
      - added MOpt dictionary support from repo
   - llvm_mode:
-    - the default instrumentation is now PCGUARD, as it is faster and provides
-      better coverage. The original afl instrumentation can be set via
-      AFL_LLVM_INSTRUMENT=AFL. This is automatically done when the WHITELIST
-      feature is used.
+    - the default instrumentation is now PCGUARD if the llvm version is >= 7,
+      as it is faster and provides better coverage. The original afl
+      instrumentation can be set via AFL_LLVM_INSTRUMENT=AFL. This is
+      automatically done when the WHITELIST feature is used. 
     - some targets want a ld variant for LD that is not gcc/clang but ld,
       added afl-ld-lto to solve this
     - lowered minimum required llvm version to 3.4 (except LLVMInsTrim, which
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index 57504e65..1e71a8d1 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -757,12 +757,14 @@ int main(int argc, char **argv, char **envp) {
 
   if (instrument_mode == 0) {
 
-#ifndef USE_TRACE_PC
-    if (getenv("AFL_LLVM_WHITELIST"))
-      instrument_mode = INSTRUMENT_AFL;
-    else
+#if LLVM_VERSION_MAJOR <= 6
+    instrument_mode = INSTRUMENT_AFL;
+#else
+  if (getenv("AFL_LLVM_WHITELIST"))
+    instrument_mode = INSTRUMENT_AFL;
+  else
+    instrument_mode = INSTRUMENT_PCGUARD;
 #endif
-      instrument_mode = INSTRUMENT_PCGUARD;
 
   }