From cbb25c63d3a0ddeda8064fc208934732b91e429a Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Date: Tue, 3 Aug 2021 15:26:35 +0200 Subject: [PATCH] Rebase to latest upstream version - Resolves #1987381 - Resolves #1983754 - Add libdebuginfod support Signed-off-by: Rafael dos Santos --- .gitignore | 1 + bcc.spec | 32 +++++++++++++++++++++++++++----- libbpftools-readahead-fix.patch | 32 ++++++++++++++++++++++++++++++++ sources | 2 +- 4 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 libbpftools-readahead-fix.patch diff --git a/.gitignore b/.gitignore index ab9e546..041b89d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ /0002-Use-libbpf-static-instead-of-libbpf-debugsource-for-.patch /bcc-src-with-submodule.tar.gz /bcc-0.20.0.tar.gz +/bcc-0.21.0.tar.gz diff --git a/bcc.spec b/bcc.spec index df74ada..4353795 100644 --- a/bcc.spec +++ b/bcc.spec @@ -26,13 +26,16 @@ %undefine __cmake_in_source_build Name: bcc -Version: 0.20.0 -Release: 5%{?dist} +Version: 0.21.0 +Release: 1%{?dist} Summary: BPF Compiler Collection (BCC) License: ASL 2.0 URL: https://github.com/iovisor/bcc Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +# https://bugzilla.redhat.com/show_bug.cgi?id=1987381 +Patch0: libbpftools-readahead-fix.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 @@ -43,6 +46,7 @@ BuildRequires: flex BuildRequires: libxml2-devel BuildRequires: python3-devel BuildRequires: elfutils-libelf-devel +BuildRequires: elfutils-debuginfod-client-devel BuildRequires: llvm-devel BuildRequires: clang-devel %if %{with llvm_static} @@ -73,6 +77,7 @@ performance analysis and network traffic control. %package devel Summary: Shared library for BPF Compiler Collection (BCC) Requires: %{name}%{?_isa} = %{version}-%{release} +Suggests: elfutils-debuginfod-client %description devel The %{name}-devel package contains libraries and header files for developing @@ -146,9 +151,19 @@ Command line libbpf tools for BPF Compiler Collection (BCC) # take them. %if %{with libbpf_tools} pushd libbpf-tools; -make BPFTOOL=bpftool LIBBPF_OBJ=%{_libdir}/libbpf.a +make BPFTOOL=bpftool LIBBPF_OBJ=%{_libdir}/libbpf.a CFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}" make DESTDIR=./tmp-install prefix= install -(cd tmp-install/bin; for file in *; do mv $file bpf-$file; done;) +( + cd tmp-install/bin + for file in *; do + mv $file bpf-$file + done + # now fix the broken symlinks + for file in `find . -type l`; do + dest=$(readlink "$file") + ln -s -f bpf-$dest $file + done +) popd %endif @@ -182,7 +197,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/tools/old/ %if %{with libbpf_tools} mkdir -p %{buildroot}/%{_sbindir} -install libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir} +# We cannot use `install` because some of the tools are symlinks and `install` +# follows those. Since all the tools already have the correct permissions set, +# we just need to copy them to the right place while preserving those +cp -a libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}/ %endif %ldconfig_scriptlets @@ -225,6 +243,10 @@ install libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir} %endif %changelog +* Mon Aug 02 2021 Rafael dos Santos - 0.21.0-1 +- Rebase to latest release version +- Add support to libdebuginfod + * Wed Jul 21 2021 Fedora Release Engineering - 0.20.0-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/libbpftools-readahead-fix.patch b/libbpftools-readahead-fix.patch new file mode 100644 index 0000000..2e34cf1 --- /dev/null +++ b/libbpftools-readahead-fix.patch @@ -0,0 +1,32 @@ +From a3c61b4b296da193fd77b06a6a9a4eb655a6cf76 Mon Sep 17 00:00:00 2001 +From: Jerome Marchand +Date: Fri, 30 Jul 2021 18:15:05 +0200 +Subject: [PATCH] libbpf-tools: readahead: don't mark struct hist as static + +Libbpf readahead tool does not compile with bpftool v5.14. Since +commit 31332ccb756 ("bpftool: Stop emitting static variables in BPF +skeleton"), bpftool gen skeleton does not include static variables +into the skeleton file anymore. + +Fixes the following compilation error: +readahead.c: In function 'main': +readahead.c:153:26: error: 'struct readahead_bpf__bss' has no member named 'hist' + 153 | histp = &obj->bss->hist; + | ^~ +--- + libbpf-tools/readahead.bpf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libbpf-tools/readahead.bpf.c b/libbpf-tools/readahead.bpf.c +index ba22e534c4..b9423c3f9a 100644 +--- a/libbpf-tools/readahead.bpf.c ++++ b/libbpf-tools/readahead.bpf.c +@@ -24,7 +24,7 @@ struct { + __uint(map_flags, BPF_F_NO_PREALLOC); + } birth SEC(".maps"); + +-static struct hist hist; ++struct hist hist = {}; + + SEC("fentry/do_page_cache_ra") + int BPF_PROG(do_page_cache_ra) diff --git a/sources b/sources index 3c845c8..c5878f1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (bcc-0.20.0.tar.gz) = fa7c50a4fc64846ad798b6652101aa414cda53d08779cf48bd505191189cb23da2838f7511e700d59e086d35216f4e3bc9867b614738061630984dff3c4576dc +SHA512 (bcc-0.21.0.tar.gz) = cd60dcd60ac0fdfc4a89dd0791f358cef0dfae5c06ef88352a256bdb13760ea8ed2cb1834f0929e66d91b2da23cf7a62fbabb36757d041e092f301fd1b368536