aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2022-03-17 16:30:44 +0100
committerGitHub <noreply@github.com>2022-03-17 16:30:44 +0100
commitd1f59435caad7d83c22cd97599f0723887f9bde3 (patch)
tree59d6f7ef2222cb92835d08398de3a1d32d2f8528 /src
parent1a65df2beee0a68bd5198a44f42ae1346f7ee231 (diff)
parent1bea949f34fb437a60ca772787a9018a3ba79053 (diff)
downloadafl++-d1f59435caad7d83c22cd97599f0723887f9bde3.tar.gz
Merge pull request #1353 from AFLplusplus/newpm2
new pass manager
Diffstat (limited to 'src')
-rw-r--r--src/afl-cc.c44
-rw-r--r--src/afl-ld-lto.c5
2 files changed, 40 insertions, 9 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c
index bacd9de9..051e4910 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -462,12 +462,18 @@ 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-switches-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-switches-pass.so", obj_path);
-
+#endif
+
}
}
@@ -482,12 +488,18 @@ 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/compare-transform-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/compare-transform-pass.so", obj_path);
-
+#endif
+
}
}
@@ -548,10 +560,10 @@ static void edit_params(u32 argc, char **argv, char **envp) {
}
-#if LLVM_MAJOR >= 13
- // Use the old pass manager in LLVM 14 which the afl++ passes still use.
- cc_params[cc_par_cnt++] = "-flegacy-pass-manager";
-#endif
+//#if LLVM_MAJOR >= 13
+// // Use the old pass manager in LLVM 14 which the afl++ passes still use.
+// cc_params[cc_par_cnt++] = "-flegacy-pass-manager";
+//#endif
if (lto_mode && !have_c) {
@@ -576,6 +588,9 @@ static void edit_params(u32 argc, char **argv, char **envp) {
free(ld_path);
cc_params[cc_par_cnt++] = "-Wl,--allow-multiple-definition";
+#if defined(AFL_CLANG_LDPATH) && LLVM_MAJOR >= 15
+ cc_params[cc_par_cnt++] = "-Wl,--lto-legacy-pass-manager";
+#endif
cc_params[cc_par_cnt++] =
alloc_printf("-Wl,-mllvm=-load=%s/SanitizerCoverageLTO.so", obj_path);
cc_params[cc_par_cnt++] = lto_flag;
@@ -601,11 +616,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/SanitizerCoveragePCGUARD.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/SanitizerCoveragePCGUARD.so", obj_path);
+ #endif
}
@@ -653,6 +674,14 @@ static void edit_params(u32 argc, char **argv, char **envp) {
} else {
+#if LLVM_MAJOR >= 11
+ cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
+ cc_params[cc_par_cnt++] = alloc_printf(
+ "-fpass-plugin=%s/cmplog-instructions-pass.so", obj_path);
+ cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
+ cc_params[cc_par_cnt++] = alloc_printf(
+ "-fpass-plugin=%s/cmplog-routines-pass.so", obj_path);
+#else
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = "-load";
cc_params[cc_par_cnt++] = "-Xclang";
@@ -664,7 +693,8 @@ static void edit_params(u32 argc, char **argv, char **envp) {
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] =
alloc_printf("%s/cmplog-routines-pass.so", obj_path);
-
+#endif
+
}
}
diff --git a/src/afl-ld-lto.c b/src/afl-ld-lto.c
index 9b58125f..5797def8 100644
--- a/src/afl-ld-lto.c
+++ b/src/afl-ld-lto.c
@@ -86,7 +86,7 @@ static void edit_params(int argc, char **argv) {
for (i = 1; i < (u32)argc; i++) {
if (strstr(argv[i], "/afl-llvm-rt-lto.o") != NULL) rt_lto_present = 1;
- if (strstr(argv[i], "/afl-llvm-rt.o") != NULL) rt_present = 1;
+ if (strstr(argv[i], "/afl-compiler-rt.o") != NULL) rt_present = 1;
if (strstr(argv[i], "/afl-llvm-lto-instr") != NULL) inst_present = 1;
}
@@ -237,7 +237,8 @@ static void edit_params(int argc, char **argv) {
}
if (!rt_present)
- ld_params[ld_param_cnt++] = alloc_printf("%s/afl-llvm-rt.o", afl_path);
+ ld_params[ld_param_cnt++] =
+ alloc_printf("%s/afl-compiler-rt.o", afl_path);
if (!rt_lto_present)
ld_params[ld_param_cnt++] =
alloc_printf("%s/afl-llvm-rt-lto.o", afl_path);