From 3572c1d51392f3e12a5c1f5d3768de591846019c Mon Sep 17 00:00:00 2001 From: Eugene Zamriy Date: Sat, 1 Apr 2023 18:37:05 +0300 Subject: [PATCH] Added temporary patch to build against libbpf-0.6.0-1 --- ...mp__new_deprecated-only-if-available.patch | 63 +++++++++++++++++++ SPECS/bpftrace.spec | 12 +++- 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 SOURCES/0001-Use-btf_dump__new_deprecated-only-if-available.patch diff --git a/SOURCES/0001-Use-btf_dump__new_deprecated-only-if-available.patch b/SOURCES/0001-Use-btf_dump__new_deprecated-only-if-available.patch new file mode 100644 index 0000000..f9a970f --- /dev/null +++ b/SOURCES/0001-Use-btf_dump__new_deprecated-only-if-available.patch @@ -0,0 +1,63 @@ +From 09a6d2c783aba4354fca5ed06438e5d7c9d4778c Mon Sep 17 00:00:00 2001 +From: Eugene Zamriy +Date: Sat, 1 Apr 2023 18:25:49 +0300 +Subject: [PATCH] Use btf_dump__new_deprecated only if available + +--- + CMakeLists.txt | 4 ++++ + cmake/FindLibBpf.cmake | 10 ++++++++++ + src/btf.cpp | 2 ++ + 3 files changed, 16 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3cfae6c..dc162f6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -261,6 +261,10 @@ if (LIBBPF_BTF_DUMP_FOUND) + endif() + endif(LIBBPF_BTF_DUMP_FOUND) + ++if (HAVE_LIBBPF_BTF_DUMP_NEW_DEPRECATED) ++ set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" HAVE_LIBBPF_BTF_DUMP_NEW_DEPRECATED) ++endif(HAVE_LIBBPF_BTF_DUMP_NEW_DEPRECATED) ++ + add_subdirectory(src/arch) + add_subdirectory(src/ast) + add_subdirectory(src) +diff --git a/cmake/FindLibBpf.cmake b/cmake/FindLibBpf.cmake +index 86eb805..e55fd03 100644 +--- a/cmake/FindLibBpf.cmake ++++ b/cmake/FindLibBpf.cmake +@@ -56,3 +56,13 @@ if (LIBBPF_FOUND) + SET(CMAKE_REQUIRED_DEFINITIONS) + SET(CMAKE_REQUIRED_LIBRARIES) + endif() ++ ++if (LIBBPF_BTF_DUMP_FOUND) ++ CHECK_CXX_SOURCE_COMPILES(" ++ #include ++ int main(void) { ++ btf_dump__new_deprecated(NULL, NULL, NULL, NULL); ++ return 0; ++ } ++ " HAVE_LIBBPF_BTF_DUMP_NEW_DEPRECATED) ++endif() +diff --git a/src/btf.cpp b/src/btf.cpp +index fccf0a0..df2eb22 100644 +--- a/src/btf.cpp ++++ b/src/btf.cpp +@@ -29,9 +29,11 @@ + * either btf_dump__new_v0_6_0() or btf_dump__new_deprecated(), which is the + * same as btf_dump__new() for libbtf < 0.6, and the one we still use. + */ ++#ifdef HAVE_LIBBPF_BTF_DUMP_NEW_DEPRECATED + #if LIBBPF_MAJOR_VERSION == 0 && LIBBPF_MINOR_VERSION >= 6 + #define btf_dump__new(a1, a2, a3, a4) btf_dump__new_deprecated(a1, a2, a3, a4) + #endif ++#endif + + #include "bpftrace.h" + +-- +2.39.2 + diff --git a/SPECS/bpftrace.spec b/SPECS/bpftrace.spec index a288818..2c634ef 100644 --- a/SPECS/bpftrace.spec +++ b/SPECS/bpftrace.spec @@ -1,6 +1,6 @@ Name: bpftrace Version: 0.13.1 -Release: 1%{?dist} +Release: 1%{?dist}.inferit Summary: High-level tracing language for Linux eBPF License: ASL 2.0 @@ -18,6 +18,9 @@ Patch8: %{name}-%{version}-biosnoop.bt-handle-Linux-5.17-block-layer-upd Patch10: %{name}-%{version}-RHEL-aarch64-fixes-statsnoop-and-opensnoop.patch +# MSVSphere patches +Patch1001: 0001-Use-btf_dump__new_deprecated-only-if-available.patch + # Arches will be included as upstream support is added and dependencies are # satisfied in the respective arches ExclusiveArch: x86_64 %{power64} aarch64 s390x @@ -54,6 +57,8 @@ and predecessor tracers such as DTrace and SystemTap %patch10 -p1 %endif +%patch1001 -p1 + %build %cmake . \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ @@ -89,8 +94,9 @@ find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \ %{_datadir}/%{name}/tools/doc/*.txt %changelog -* Wed Mar 15 2023 MSVSphere Packaging Team - 0.13.1-1 -- Rebuilt for MSVSphere 9.1. +* Sat Apr 01 2023 Eugene Zamriy - 0.13.1-1 +- Added temporary patch to build against libbpf-0.6.0-1 +- Rebuilt for MSVSphere 9.1 * Mon May 16 2022 Jerome Marchand - 0.13.1-1 - Rebase to bpftrace 0.13.1