diff --git a/.gitignore b/.gitignore index 4ef0033..ab9e546 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /0001-Add-libbcc-no-libbpf.so-library.patch /0002-Use-libbpf-static-instead-of-libbpf-debugsource-for-.patch /bcc-src-with-submodule.tar.gz +/bcc-0.20.0.tar.gz diff --git a/bcc-0.15.0-Reinstate-bpf_detach_kfunc.patch b/bcc-0.15.0-Reinstate-bpf_detach_kfunc.patch deleted file mode 100644 index bc995c6..0000000 --- a/bcc-0.15.0-Reinstate-bpf_detach_kfunc.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0b9a7f0de847d945bc5dd83961136e04d6c890ec Mon Sep 17 00:00:00 2001 -From: Jerome Marchand -Date: Wed, 1 Jul 2020 17:52:51 +0200 -Subject: [PATCH] Reinstate bpf_detach_kfunc - -It doesn't do anything, but bpftrace still calls it. - ---- - src/cc/libbpf.c | 7 +++++++ - src/cc/libbpf.h | 2 ++ - 2 files changed, 9 insertions(+) - -diff --git a/src/cc/libbpf.c b/src/cc/libbpf.c -index 010d1222..4c43218f 100644 ---- a/src/cc/libbpf.c -+++ b/src/cc/libbpf.c -@@ -1186,6 +1186,13 @@ bool bpf_has_kernel_btf(void) - return libbpf_find_vmlinux_btf_id("bpf_prog_put", 0) > 0; - } - -+int bpf_detach_kfunc(int prog_fd, char *func) -+{ -+ UNUSED(prog_fd); -+ UNUSED(func); -+ return 0; -+} -+ - int bpf_attach_kfunc(int prog_fd) - { - int ret; -diff --git a/src/cc/libbpf.h b/src/cc/libbpf.h -index 61471b5b..bcae5c99 100644 ---- a/src/cc/libbpf.h -+++ b/src/cc/libbpf.h -@@ -94,6 +94,8 @@ int bpf_detach_tracepoint(const char *tp_category, const char *tp_name); - - int bpf_attach_raw_tracepoint(int progfd, const char *tp_name); - -+ int bpf_detach_kfunc(int prog_fd, char *func); -+ - int bpf_attach_kfunc(int prog_fd); - - int bpf_attach_lsm(int prog_fd); --- -2.25.4 - diff --git a/bcc.spec b/bcc.spec index e2101d5..1019c0b 100644 --- a/bcc.spec +++ b/bcc.spec @@ -10,25 +10,24 @@ %endif %endif +%ifarch x86_64 ppc64 ppc64le aarch64 +%bcond_without libbpf_tools +%else +%bcond_with libbpf_tools +%endif + %bcond_with llvm_static %if %{without llvm_static} %global with_llvm_shared 1 %endif -# LTO causes -# /usr/bin/ld: CMakeFiles/test_libbcc.dir/test_bpf_table.cc.o (symbol from plugin): -# undefined reference to symbol '_ZZNSt8__detail18__to_chars_10_implIjEEvPcjT_E8__digits@@LLVM_11' -%ifarch armv7hl -%global _lto_cflags %{nil} -%endif - # Force out of source build %undefine __cmake_in_source_build Name: bcc -Version: 0.18.0 -Release: 6%{?dist} +Version: 0.20.0 +Release: 1%{?dist} Summary: BPF Compiler Collection (BCC) License: ASL 2.0 URL: https://github.com/iovisor/bcc @@ -36,8 +35,6 @@ URL: https://github.com/iovisor/bcc Source0: %{url}/releases/download/v%{version}/%{name}-src-with-submodule.tar.gz #Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz -Patch0: %{name}-0.15.0-Reinstate-bpf_detach_kfunc.patch - # Arches will be included as upstream support is added and dependencies are # satisfied in the respective arches ExclusiveArch: x86_64 %{power64} aarch64 s390x armv7hl @@ -61,6 +58,8 @@ BuildRequires: libbpf-devel >= 0.0.5-3, libbpf-static >= 0.0.5-3 Requires: %{name}-tools = %{version}-%{release} Requires: libbpf >= 0.0.5-3 +Requires: tar +Recommends: kernel-devel %description BCC is a toolkit for creating efficient kernel tracing and manipulation @@ -115,11 +114,19 @@ Standalone tool to run BCC tracers written in Lua Summary: Command line tools for BPF Compiler Collection (BCC) Requires: python3-%{name} = %{version}-%{release} Requires: python3-netaddr -Requires: kernel-devel %description tools Command line tools for BPF Compiler Collection (BCC) +%if %{with libbpf_tools} +%package -n libbpf-tools +Summary: Command line libbpf tools for BPF Compiler Collection (BCC) +BuildRequires: libbpf-devel >= 0.0.5-3, libbpf-static >= 0.0.5-3 +BuildRequires: bpftool + +%description -n libbpf-tools +Command line libbpf tools for BPF Compiler Collection (BCC) +%endif %prep %autosetup -p1 -n %{name} @@ -133,6 +140,18 @@ Command line tools for BPF Compiler Collection (BCC) %{?with_llvm_shared:-DENABLE_LLVM_SHARED=1} %cmake_build +# It was discussed and agreed to package libbpf-tools with +# 'bpf-' prefix (https://github.com/iovisor/bcc/pull/3263) +# Installing libbpf-tools binaries in temp directory and +# renaming them in there and the install code will just +# take them. +%if %{with libbpf_tools} +pushd libbpf-tools; +make BPFTOOL=bpftool +make DESTDIR=./tmp-install prefix= install +(cd tmp-install/bin; for file in *; do mv $file bpf-$file; done;) +popd +%endif %install %cmake_install @@ -162,6 +181,11 @@ rm -rf %{buildroot}%{_datadir}/%{name}/tools/old/ # the machine (e.g, IP address) #%check +%if %{with libbpf_tools} +mkdir -p %{buildroot}/%{_sbindir} +install libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir} +%endif + %ldconfig_scriptlets %files @@ -169,14 +193,12 @@ rm -rf %{buildroot}%{_datadir}/%{name}/tools/old/ %license LICENSE.txt %{_libdir}/lib%{name}.so.* %{_libdir}/libbcc_bpf.so.* -%{_libdir}/libbcc-no-libbpf.so.* %files devel %exclude %{_libdir}/lib%{name}*.a %exclude %{_libdir}/lib%{name}*.la %{_libdir}/lib%{name}.so %{_libdir}/libbcc_bpf.so -%{_libdir}/libbcc-no-libbpf.so %{_libdir}/pkgconfig/lib%{name}.pc %{_includedir}/%{name}/ @@ -198,8 +220,15 @@ rm -rf %{buildroot}%{_datadir}/%{name}/tools/old/ %{_bindir}/bcc-lua %endif +%if %{with libbpf_tools} +%files -n libbpf-tools +%{_sbindir}/bpf-* +%endif %changelog +* Thu May 27 2021 Jerome Marchand - 0.20.0-1 +- Rebase to bcc 0.20.0 + * Thu May 13 2021 Tom Stellard - 0.18.0-6 - Rebuild for LLVM 12 diff --git a/sources b/sources index 3eb36dd..1d9ad9f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (bcc-src-with-submodule.tar.gz) = 2f3d571f44054f872fd314fd9de72aafb8d10779e736d71c2b48558950cdda3546900df0a52a9d882eb898467bd33a0888458ff4af0ca408b33d8c56a49dbffa +SHA512 (bcc-src-with-submodule.tar.gz) = 60ab3e7e11015878895d009afb2290d1e677e3c7bc04f493eb586136af190d7c0930757b34e721822eaf6700ecc17edeb30a4b04ea29c4a26cb885164060030a