about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2022-03-18 08:47:45 +0100
committervanhauser-thc <vh@thc.org>2022-03-18 08:47:45 +0100
commitbdfac291ba653b34a1d304d6135111d68b8d8267 (patch)
treee6a900ff7145b7ee63afdbeade019cb5b0cecef8
parent90fd61d14a3a154ed58461a9e3eaf2c91d094a86 (diff)
downloadafl++-bdfac291ba653b34a1d304d6135111d68b8d8267.tar.gz
fix split pass loading
-rw-r--r--docs/Changelog.md2
-rw-r--r--src/afl-cc.c19
2 files changed, 19 insertions, 2 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 18a4debf..d672686d 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -24,6 +24,8 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
       possible in the target (for afl-gcc-fast/afl-clang-fast/
       afl-clang-lto)
   - afl-cc:
+    ! llvm15-dev with LTO and extra features (LAF/CMPLOG etc.) might have
+      issues at the moment
     - converted all passed to use the new llvm pass manager for llvm 11+
   - frida_mode:
     - update to new frida release, handles now c++ throw/catch
diff --git a/src/afl-cc.c b/src/afl-cc.c
index 0d5951bb..487f394e 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -526,11 +526,17 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
       } else {
 
+#if LLVM_MAJOR >= 11                                /* use new pass manager */
+        cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
+        cc_params[cc_par_cnt++] =
+            alloc_printf("-fpass-plugin=%s/split-compares-pass.so", obj_path);
+#else
         cc_params[cc_par_cnt++] = "-Xclang";
         cc_params[cc_par_cnt++] = "-load";
         cc_params[cc_par_cnt++] = "-Xclang";
         cc_params[cc_par_cnt++] =
             alloc_printf("%s/split-compares-pass.so", obj_path);
+#endif
 
       }
 
@@ -553,6 +559,16 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
       } else {
 
+        cc_params[cc_par_cnt++] = "-fno-inline";
+
+#if LLVM_MAJOR >= 11                                /* use new pass manager */
+        cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
+        cc_params[cc_par_cnt++] =
+            alloc_printf("-fpass-plugin=%s/cmplog-switches-pass.so", obj_path);
+        cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
+        cc_params[cc_par_cnt++] =
+            alloc_printf("-fpass-plugin=%s/split-switches-pass.so", obj_path);
+#else
         cc_params[cc_par_cnt++] = "-Xclang";
         cc_params[cc_par_cnt++] = "-load";
         cc_params[cc_par_cnt++] = "-Xclang";
@@ -565,11 +581,10 @@ static void edit_params(u32 argc, char **argv, char **envp) {
         cc_params[cc_par_cnt++] = "-Xclang";
         cc_params[cc_par_cnt++] =
             alloc_printf("%s/split-switches-pass.so", obj_path);
+#endif
 
       }
 
-      cc_params[cc_par_cnt++] = "-fno-inline";
-
     }
 
     //#if LLVM_MAJOR >= 13