From 9f91126ce7747f7a9f9755a98868a0d34c9d75f9 Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Sat, 26 Nov 2022 17:41:33 -0800 Subject: [PATCH] Fix a llvm compilation error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit With latest llvm16, I got the following compilation error: /.../src/cc/bpf_module.cc: In member function ‘void ebpf::BPFModule::dump_ir(llvm::Module&)’: /.../src/cc/bpf_module.cc:259:15: error: ‘PrintModulePass’ was not declared in this scope MPM.addPass(PrintModulePass(errs())); ^~~~~~~~~~~~~~~ ... The error is due to the llvm patch https://reviews.llvm.org/D138081. Fix the issue by adjust corresponding header file locaiton as in the above llvm patch. Signed-off-by: Yonghong Song --- src/cc/bpf_module.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cc/bpf_module.cc b/src/cc/bpf_module.cc index 97f4518c..f48df7af 100644 --- a/src/cc/bpf_module.cc +++ b/src/cc/bpf_module.cc @@ -25,7 +25,11 @@ #include #include +#if LLVM_MAJOR_VERSION >= 16 +#include +#else #include +#endif #include #include -- 2.34.1