From df9b5b7e3d7189d47b428c85a4ca9ad9fc457900 Mon Sep 17 00:00:00 2001 From: lazymio Date: Mon, 12 May 2025 21:54:43 +0800 Subject: [PATCH] Fix for LLVM-15 (#3215) --- libafl_cc/build.rs | 1 + libafl_cc/src/common-llvm.h | 4 ++++ libafl_cc/src/coverage-accounting-pass.cc | 2 ++ 3 files changed, 7 insertions(+) diff --git a/libafl_cc/build.rs b/libafl_cc/build.rs index 187ae2b239..22392b1ac0 100644 --- a/libafl_cc/build.rs +++ b/libafl_cc/build.rs @@ -427,6 +427,7 @@ pub const LIBAFL_CC_LLVM_VERSION: Option = None; if cfg!(unix) { cxxflags.push(String::from("-shared")); cxxflags.push(String::from("-fPIC")); + cxxflags.push(String::from("-std=c++17")); // std::nullopt_t requires this } if cfg!(windows) { cxxflags.push(String::from("-fuse-ld=lld")); diff --git a/libafl_cc/src/common-llvm.h b/libafl_cc/src/common-llvm.h index 5832f03b82..97229d9df9 100644 --- a/libafl_cc/src/common-llvm.h +++ b/libafl_cc/src/common-llvm.h @@ -10,7 +10,11 @@ #define HAVE_VECTOR_INTRINSICS 1 #include +#if LLVM_VERSION_MAJOR >= 16 +// None constant being deprecated for LLVM-16, it is recommended +// to use the std::nullopt_t type instead. (#1010) constexpr std::nullopt_t None = std::nullopt; +#endif // all llvm includes and friends #include "llvm/Support/CommandLine.h" diff --git a/libafl_cc/src/coverage-accounting-pass.cc b/libafl_cc/src/coverage-accounting-pass.cc index bb4fa7b8ab..6dfa1b459d 100644 --- a/libafl_cc/src/coverage-accounting-pass.cc +++ b/libafl_cc/src/coverage-accounting-pass.cc @@ -283,6 +283,8 @@ PreservedAnalyses AFLCoverage::run(Module &M, ModuleAnalysisManager &MAM) { } break; } + default: + break; } } /* Make up cur_loc */