From 6918229d8b6e16cd8d248ce42c54a8dee9e47b12 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 11 Jan 2022 12:17:13 -0500 Subject: [PATCH] import bcc-0.20.0-8.el9 --- ...-0.20.0-Fix-a-llvm-compilation-error.patch | 46 +++++++++++++++++++ ...-APSInt-toString-std-string-variants.patch | 41 +++++++++++++++++ SPECS/bcc.spec | 7 ++- 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 SOURCES/bcc-0.20.0-Fix-a-llvm-compilation-error.patch create mode 100644 SOURCES/bcc-0.20.0-Remove-APInt-APSInt-toString-std-string-variants.patch diff --git a/SOURCES/bcc-0.20.0-Fix-a-llvm-compilation-error.patch b/SOURCES/bcc-0.20.0-Fix-a-llvm-compilation-error.patch new file mode 100644 index 0000000..5c15817 --- /dev/null +++ b/SOURCES/bcc-0.20.0-Fix-a-llvm-compilation-error.patch @@ -0,0 +1,46 @@ +From e2a4a556755d3c5ae7538ba9bcb731f93b9f81c9 Mon Sep 17 00:00:00 2001 +From: Yonghong Song +Date: Tue, 25 May 2021 19:58:00 -0700 +Subject: [PATCH] Fix a llvm compilation error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Current llvm trunk (https://github.com/llvm/llvm-project) +will cause the following compilation errors: + /home/yhs/work/bcc/src/cc/bcc_debug.cc: In member function ‘void ebpf::SourceDebugger::dump()’: + /home/yhs/work/bcc/src/cc/bcc_debug.cc:135:75: error: no matching function for call to + ‘llvm::MCContext::MCContext(llvm::Triple&, std::unique_ptr::pointer, + std::unique_ptr::pointer, llvm::MCObjectFileInfo*, + std::unique_ptr::pointer, std::nullptr_t)’ + MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr); + ^ + ...... + +This is because upstream patch https://reviews.llvm.org/D101921 +refactored MCObjectFileInfo initialization and changed MCContext +constructor signature. + +This patch fixed the issue by following the new code patterns +in https://reviews.llvm.org/D101921. +--- + src/cc/bcc_debug.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/cc/bcc_debug.cc b/src/cc/bcc_debug.cc +index 775c9141..97d6d95b 100644 +--- a/src/cc/bcc_debug.cc ++++ b/src/cc/bcc_debug.cc +@@ -132,7 +132,8 @@ void SourceDebugger::dump() { + T->createMCSubtargetInfo(TripleStr, "", "")); + MCObjectFileInfo MOFI; + #if LLVM_MAJOR_VERSION >= 13 +- MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr); ++ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), nullptr); ++ Ctx.setObjectFileInfo(&MOFI); + MOFI.initMCObjectFileInfo(Ctx, false, false); + #else + MCContext Ctx(MAI.get(), MRI.get(), &MOFI, nullptr); +-- +2.31.1 + diff --git a/SOURCES/bcc-0.20.0-Remove-APInt-APSInt-toString-std-string-variants.patch b/SOURCES/bcc-0.20.0-Remove-APInt-APSInt-toString-std-string-variants.patch new file mode 100644 index 0000000..182209e --- /dev/null +++ b/SOURCES/bcc-0.20.0-Remove-APInt-APSInt-toString-std-string-variants.patch @@ -0,0 +1,41 @@ +From fd0585d5d8a1a47912ae7a70721d3cab0c7d06f8 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 14 Jun 2021 12:49:43 -0700 +Subject: [PATCH] Remove APInt/APSInt toString() std::string variants + +clang 13+ has removed this in favour of a pair of llvm::toString +() helpers inside StringExtras.h to improve compile speed by avoiding +hits on header + +Signed-off-by: Khem Raj +--- + src/cc/json_map_decl_visitor.cc | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/cc/json_map_decl_visitor.cc b/src/cc/json_map_decl_visitor.cc +index eff4d067..53896199 100644 +--- a/src/cc/json_map_decl_visitor.cc ++++ b/src/cc/json_map_decl_visitor.cc +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include "common.h" + #include "table_desc.h" + +@@ -79,7 +80,11 @@ void BMapDeclVisitor::genJSONForField(FieldDecl *F) { + result_ += "["; + TraverseDecl(F); + if (const ConstantArrayType *T = dyn_cast(F->getType())) ++#if LLVM_MAJOR_VERSION >= 13 ++ result_ += ", [" + toString(T->getSize(), 10, false) + "]"; ++#else + result_ += ", [" + T->getSize().toString(10, false) + "]"; ++#endif + if (F->isBitField()) + result_ += ", " + to_string(F->getBitWidthValue(C)); + result_ += "], "; +-- +2.31.1 + diff --git a/SPECS/bcc.spec b/SPECS/bcc.spec index e0f90e9..41d13e6 100644 --- a/SPECS/bcc.spec +++ b/SPECS/bcc.spec @@ -27,7 +27,7 @@ Name: bcc Version: 0.20.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: BPF Compiler Collection (BCC) License: ASL 2.0 URL: https://github.com/iovisor/bcc @@ -42,6 +42,8 @@ Patch6: %{name}-%{version}-Update-cpudist.py.patch Patch7: %{name}-%{version}-tools-readahead-compatible-with-kernel-version-5.10-.patch Patch8: %{name}-%{version}-Fix-mdflush-on-RHEL9.patch Patch9: %{name}-%{version}-Handle-renaming-of-task_struct_-state-field-on-RHEL-.patch +Patch10: %{name}-%{version}-Fix-a-llvm-compilation-error.patch +Patch11: %{name}-%{version}-Remove-APInt-APSInt-toString-std-string-variants.patch # Arches will be included as upstream support is added and dependencies are # satisfied in the respective arches @@ -253,6 +255,9 @@ install libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir} %endif %changelog +* Mon Nov 22 2021 Jerome Marchand - 0.20.0-8 +- Rebuild for LLVM 13 + * Thu Oct 14 2021 Jerome Marchand - 0.20.0-7 - Sync with latest libbpf (fixes BPF_F_BROADCAST breakages of rhbz#1992430) - Fix cpudist, mdflush, readahead and threadsnoop (rhbz#1992430)