From fffca639fb800707d27f0c051edc6d8dfb3c2046 Mon Sep 17 00:00:00 2001 From: Jerome Marchand Date: Mon, 12 Jun 2023 08:48:17 +0200 Subject: [PATCH] Fix compilation with llvm 16 LLVM 16 was in RHEL 8.9 buildroot, but not in the c8s one yet and previous c8s rebuild was in fact with llvm 15. It failed on rhel, but I didn't noticed. Resolves: rhbz#2192949 --- bcc-0.25.0-Fix-a-llvm-compilation-error.patch | 43 +++++++++++++++++++ bcc.spec | 6 ++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 bcc-0.25.0-Fix-a-llvm-compilation-error.patch diff --git a/bcc-0.25.0-Fix-a-llvm-compilation-error.patch b/bcc-0.25.0-Fix-a-llvm-compilation-error.patch new file mode 100644 index 0000000..566358d --- /dev/null +++ b/bcc-0.25.0-Fix-a-llvm-compilation-error.patch @@ -0,0 +1,43 @@ +From f04aaed5402f847ea0127de7ca573d39c57da891 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=UTF-8 +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 490fffe8..0f4a4f58 100644 +--- a/src/cc/bpf_module.cc ++++ b/src/cc/bpf_module.cc +@@ -20,7 +20,11 @@ + #include + #include + #include ++#if LLVM_MAJOR_VERSION >= 16 ++#include ++#else + #include ++#endif + #include + #include + +-- +2.40.1 + diff --git a/bcc.spec b/bcc.spec index 59200c8..3cd4c71 100644 --- a/bcc.spec +++ b/bcc.spec @@ -9,7 +9,7 @@ Name: bcc Version: 0.25.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: BPF Compiler Collection (BCC) License: ASL 2.0 URL: https://github.com/iovisor/bcc @@ -25,6 +25,7 @@ Patch7: %{name}-%{version}-Fix-a-llvm-signed-division-error-for-compacts Patch8: %{name}-%{version}-tools-compactsnoop.py-Fix-raw_tracepoint-Invalid-arg.patch Patch9: %{name}-%{version}-Revert-tools-Fix-bindsnoop-for-kernel-v5.6.patch Patch10: %{name}-%{version}-tools-nfsslower.py-Fix-uninitialized-struct-pad-erro.patch +Patch11: %{name}-%{version}-Fix-a-llvm-compilation-error.patch # Arches will be included as upstream support is added and dependencies are # satisfied in the respective arches @@ -222,6 +223,9 @@ done %changelog +* Mon Jun 12 2023 Jerome Marchand - 0.25.0-5 +- Fix LLVM 16 build + * Thu Jun 08 2023 Jerome Marchand - 0.25.0-4 - Add missing patch.