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
This commit is contained in:
Jerome Marchand 2023-06-12 08:48:17 +02:00
parent ca31082653
commit fffca639fb
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From f04aaed5402f847ea0127de7ca573d39c57da891 Mon Sep 17 00:00:00 2001
From: Yonghong Song <yhs@fb.com>
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 <yhs@fb.com>
---
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 <llvm-c/Transforms/IPO.h>
#include <llvm/ExecutionEngine/MCJIT.h>
#include <llvm/ExecutionEngine/SectionMemoryManager.h>
+#if LLVM_MAJOR_VERSION >= 16
+#include <llvm/IRPrinter/IRPrintingPasses.h>
+#else
#include <llvm/IR/IRPrintingPasses.h>
+#endif
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h>
--
2.40.1

View File

@ -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 <jmarchan@redhat.com> - 0.25.0-5
- Fix LLVM 16 build
* Thu Jun 08 2023 Jerome Marchand <jmarchan@redhat.com> - 0.25.0-4
- Add missing patch.