Updated temporary patch to build against libbpf-0.6.0-1

i9 changed/i9/bpftrace-0.16.0-2.el9.inferit
Sergey Cherevko 2 years ago
parent 12db43ca30
commit 96d78a3498
Signed by: scherevko
GPG Key ID: D87CBBC16D2E4A72

@ -1,16 +1,16 @@
From 09a6d2c783aba4354fca5ed06438e5d7c9d4778c Mon Sep 17 00:00:00 2001
From: Eugene Zamriy <eugene@zamriy.info>
Date: Sat, 1 Apr 2023 18:25:49 +0300
From 680faba73538413bdbac4c01398d73b58c6b1874 Mon Sep 17 00:00:00 2001
From: Sergey Cherevko <s.cherevko@msvsphere.ru>
Date: Wed, 17 May 2023 16:42:35 +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(+)
src/btf.cpp | 6 +++++-
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3cfae6c..dc162f6 100644
index e63bc83..0e45811 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -261,6 +261,10 @@ if (LIBBPF_BTF_DUMP_FOUND)
@ -21,18 +21,17 @@ index 3cfae6c..dc162f6 100644
+ 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)
if (HAVE_LIBBPF_BPF_PROG_LOAD)
set(BPFTRACE_FLAGS "${BPFTRACE_FLAGS}" HAVE_LIBBPF_BPF_PROG_LOAD)
endif(HAVE_LIBBPF_BPF_PROG_LOAD)
diff --git a/cmake/FindLibBpf.cmake b/cmake/FindLibBpf.cmake
index 86eb805..e55fd03 100644
index dd0eeea..7c04655 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()
+
@@ -48,6 +48,16 @@ check_symbol_exists(btf_dump__new "${LIBBPF_INCLUDE_DIRS}/bpf/btf.h" HAVE_BTF_DU
if (HAVE_BTF_DUMP)
set(LIBBPF_BTF_DUMP_FOUND TRUE)
endif ()
+if (LIBBPF_BTF_DUMP_FOUND)
+ CHECK_CXX_SOURCE_COMPILES("
+ #include <bpf/btf.h>
@ -42,22 +41,27 @@ index 86eb805..e55fd03 100644
+ }
+ " HAVE_LIBBPF_BTF_DUMP_NEW_DEPRECATED)
+endif()
+
check_symbol_exists(btf_dump__emit_type_decl "${LIBBPF_INCLUDE_DIRS}/bpf/btf.h" HAVE_LIBBPF_BTF_DUMP_EMIT_TYPE_DECL)
check_symbol_exists(bpf_prog_load "${LIBBPF_INCLUDE_DIRS}/bpf/bpf.h" HAVE_LIBBPF_BPF_PROG_LOAD)
diff --git a/src/btf.cpp b/src/btf.cpp
index fccf0a0..df2eb22 100644
index b8c6bd6..32375a1 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.
*/
@@ -23,7 +23,11 @@
#include <bpf/btf.h>
#pragma GCC diagnostic pop
#include <bpf/libbpf.h>
-
+#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
+#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"
namespace bpftrace {
--
2.39.2

@ -1,6 +1,6 @@
Name: bpftrace
Version: 0.16.0
Release: 2%{?dist}
Release: 2%{?dist}.inferit
Summary: High-level tracing language for Linux eBPF
License: ASL 2.0
@ -100,9 +100,9 @@ find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \
%exclude %{_datadir}/%{name}/tools/old
%changelog
* 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
* Wed May 17 2023 Sergey Cherevko <s.cherevko@msvsphere.ru> - 0.16.0-2.inferit
- Updated temporary patch to build against libbpf-0.6.0-1
- Rebuilt for MSVSphere 9.2
* Tue Jan 03 2023 Viktor Malik <vmalik@redhat.com> - 0.16.0-2
- Fix missing kprobe attachpoints for bio* tools (s390x, ppc64le)

Loading…
Cancel
Save