Compare commits

..

No commits in common. "e93bd624cbe72efffdc2c79d873bf94c70f88fed" and "c491e3fc3d3a633c7adfaf488a42bc04c0d9c238" have entirely different histories.

5 changed files with 22 additions and 65 deletions

View File

@ -1,41 +0,0 @@
From e3894c8fac52ce6b7861bd491ef70406545d0f40 Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Wed, 23 Mar 2022 09:47:25 +0100
Subject: [PATCH] Fix libbtf 0.6.0 build
Libbpf 0.6.0 introduced a new version of btf_dump__new(). The new
version is btf_dump__new_v0_6_0() while the old version was renamed
btf_dump__new_deprecated(). btf_dump__new() is now overloaded,
unfortunately the macro doesn't work on cpp.
Let's call btf_dump__new_deprecated() explicitely when libbpbf version
is above 0.6.0. That should work till support for the deprecated
function is removed in libbpf 1.0.0.
Fixes #2068
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
src/btf.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/btf.cpp b/src/btf.cpp
index 7d83cf687e..83bc6e901e 100644
--- a/src/btf.cpp
+++ b/src/btf.cpp
@@ -24,6 +24,15 @@
#pragma GCC diagnostic pop
#include <bpf/libbpf.h>
+/*
+ * Since libbtf 0.6, btf_dump__new() has been overloaded and now can design
+ * 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.
+ */
+#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
+
#include "bpftrace.h"
namespace bpftrace {

BIN
bpftrace-0.10.0.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +1,11 @@
Name: bpftrace
Version: 0.14.1
Release: 4
Version: 0.10.0
Release: 2
Summary: High-level tracing language for Linux eBPF
License: ASL 2.0
URL: https://github.com/iovisor/bpftrace
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0000: Choose-to-use-a-functional-interface-to-fix-build-error.patch
# Arches will be included as upstream support is added and dependencies are
# satisfied in the respective arches
@ -14,10 +13,10 @@ ExclusiveArch: x86_64 %{power64} aarch64
BuildRequires: gcc-c++ bison flex cmake elfutils-libelf-devel
BuildRequires: zlib-devel llvm-devel clang-devel
BuildRequires: bcc-devel >= 0.19.0-1
BuildRequires: bcc-devel >= 0.11.0-2
BuildRequires: libbpf-devel libbpf-static
BuildRequires: binutils-devel
BuildRequires: cereal-devel libdwarf-devel rubygem-asciidoctor
Patch0001: fix_build_error.patch
%description
bpftrace is a high-level tracing language for Linux enhanced Berkeley Packet
@ -38,13 +37,11 @@ and predecessor tracers such as DTrace and SystemTap.
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTING:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DENABLE_LLVM_SHARED=1
-DLIBBCC_LIBRARIES:PATH=/usr/lib64/libbcc-no-libbpf.so
%make_build
%install
%global __os_install_post %{nil}
%global _find_debuginfo_opts -g
%make_install
find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \
@ -59,28 +56,12 @@ find %{buildroot}%{_datadir}/%{name}/tools -type f -exec \
%dir %{_datadir}/%{name}/tools
%dir %{_datadir}/%{name}/tools/doc
%{_bindir}/%{name}
%{_bindir}/%{name}-aotrt
%{_mandir}/man8/*
%attr(0755,-,-) %{_datadir}/%{name}/tools/*.bt
%{_datadir}/%{name}/tools/doc/*.txt
%changelog
* Fri Nov 11 2022 xu_ping <xuping33@h-partners.com> - 0.14.1-4
- Use a functional interface depending on the version to fix build error
* Thu Jun 9 2022 LemmyHuang <huangliming5@huawei.com> - 0.14.1-3
- fix abort on startup caused by llvm compiler
* Sat May 7 2022 liyanan <liyanan32@h-partners.com> - 0.14.1-2
- Fix 'bpftrace symbols are stripped'
* Fri Apr 22 2022 yaoxin <yaoxin30@h-partners.com> - 0.14.1-1
- Update to 0.14.1
* Mon Jan 10 2022 liyanan <liyanan32@huawei.com> - 0.13.0-1
- update to 0.13.0
* Mon Nov 9 2020 wutao <wutao61@huawei.com> - 0.10.0-2
- fix build error

17
fix_build_error.patch Normal file
View File

@ -0,0 +1,17 @@
From b7a8159fcaaeb7d0e2e64c2474f05ca199d970e8 Mon Sep 17 00:00:00 2001
From: William Findlay <william@williamfindlay.com>
Date: Sun, 21 Jun 2020 13:18:54 -0400
Subject: [PATCH] Return 0 in detach_kfunc
diff --git a/bpftrace-0.10.0-old/src/attached_probe.cpp b/bpftrace-0.10.0/src/attached_probe.cpp
index 16486b6..8a2f739 100644
--- a/src/attached_probe.cpp
+++ b/src/attached_probe.cpp
@@ -115,7 +115,7 @@ void AttachedProbe::attach_kfunc(void)
int AttachedProbe::detach_kfunc(void)
{
close(tracing_fd_);
- return bpf_detach_kfunc(progfd_, NULL);
+ return 0;
}
#else
void AttachedProbe::attach_kfunc(void)