Added temporary patch to build against libbpf-0.6.0-1

i9 changed/i9/bpftrace-0.13.1-1.el9.inferit
Eugene Zamriy 2 years ago
parent 1240b5d1d5
commit 3572c1d513
Signed by: ezamriy
GPG Key ID: 7EBF95C7DCFA496C

@ -0,0 +1,63 @@
From 09a6d2c783aba4354fca5ed06438e5d7c9d4778c Mon Sep 17 00:00:00 2001
From: Eugene Zamriy <eugene@zamriy.info>
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 <bpf/btf.h>
+ 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

@ -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 <packager@msvsphere.ru> - 0.13.1-1
- Rebuilt for MSVSphere 9.1.
* Sat Apr 01 2023 Eugene Zamriy <ezamriy@msvsphere.ru> - 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 <jmarchan@redhat.com> - 0.13.1-1
- Rebase to bpftrace 0.13.1

Loading…
Cancel
Save