mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-19 04:58:08 +00:00
Fix loading and registeration of LTO pass for new pass manager
This commit is contained in:
@ -324,8 +324,11 @@ llvmGetPassPluginInfo() {
|
|||||||
#if LLVM_VERSION_MAJOR <= 13
|
#if LLVM_VERSION_MAJOR <= 13
|
||||||
using OptimizationLevel = typename PassBuilder::OptimizationLevel;
|
using OptimizationLevel = typename PassBuilder::OptimizationLevel;
|
||||||
#endif
|
#endif
|
||||||
// PB.registerFullLinkTimeOptimizationLastEPCallback(
|
#if LLVM_VERSION_MAJOR >= 15
|
||||||
|
PB.registerFullLinkTimeOptimizationLastEPCallback(
|
||||||
|
#else
|
||||||
PB.registerOptimizerLastEPCallback(
|
PB.registerOptimizerLastEPCallback(
|
||||||
|
#endif
|
||||||
[](ModulePassManager &MPM, OptimizationLevel OL) {
|
[](ModulePassManager &MPM, OptimizationLevel OL) {
|
||||||
|
|
||||||
MPM.addPass(ModuleSanitizerCoverageLTO());
|
MPM.addPass(ModuleSanitizerCoverageLTO());
|
||||||
|
12
src/afl-cc.c
12
src/afl-cc.c
@ -666,15 +666,21 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
#endif
|
#endif
|
||||||
free(ld_path);
|
free(ld_path);
|
||||||
|
|
||||||
#if defined(AFL_CLANG_LDPATH) && LLVM_MAJOR >= 13
|
#if defined(AFL_CLANG_LDPATH) && LLVM_MAJOR >= 15
|
||||||
|
// The NewPM implementation only works fully since LLVM 15.
|
||||||
|
cc_params[cc_par_cnt++] =
|
||||||
|
alloc_printf("-Wl,--load-pass-plugin=%s/SanitizerCoverageLTO.so", obj_path);
|
||||||
|
#elif defined(AFL_CLANG_LDPATH) && LLVM_MAJOR >= 13
|
||||||
cc_params[cc_par_cnt++] = "-Wl,--lto-legacy-pass-manager";
|
cc_params[cc_par_cnt++] = "-Wl,--lto-legacy-pass-manager";
|
||||||
|
cc_params[cc_par_cnt++] =
|
||||||
|
alloc_printf("-Wl,-mllvm=-load=%s/SanitizerCoverageLTO.so", obj_path);
|
||||||
#else
|
#else
|
||||||
cc_params[cc_par_cnt++] = "-fno-experimental-new-pass-manager";
|
cc_params[cc_par_cnt++] = "-fno-experimental-new-pass-manager";
|
||||||
|
cc_params[cc_par_cnt++] =
|
||||||
|
alloc_printf("-Wl,-mllvm=-load=%s/SanitizerCoverageLTO.so", obj_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cc_params[cc_par_cnt++] = "-Wl,--allow-multiple-definition";
|
cc_params[cc_par_cnt++] = "-Wl,--allow-multiple-definition";
|
||||||
cc_params[cc_par_cnt++] =
|
|
||||||
alloc_printf("-Wl,-mllvm=-load=%s/SanitizerCoverageLTO.so", obj_path);
|
|
||||||
cc_params[cc_par_cnt++] = lto_flag;
|
cc_params[cc_par_cnt++] = lto_flag;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user