Rebase to the latest version

Rebase bcc to v0.24 and misc fixes:
- Fix cmake build
- Add explicit Requires: bcc for bcc-tools
- Remove deprecated python_provide macro

Resolves #2023581

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
Jerome Marchand 2022-02-25 09:57:59 +01:00
parent b3e2fbac49
commit a7f5f38c0d
2 changed files with 62 additions and 10 deletions

View File

@ -22,16 +22,15 @@
%global with_llvm_shared 1
%endif
# Force out of source build
%undefine __cmake_in_source_build
Name: bcc
Version: 0.22.0
Release: 3%{?dist}
Version: 0.24.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
Patch0: libbpf-tools-Allow-to-use-different-cflags-for-bpf-t.patch
# Arches will be included as upstream support is added and dependencies are
# satisfied in the respective arches
@ -95,7 +94,6 @@ Examples for BPF Compiler Collection (BCC)
Summary: Python3 bindings for BPF Compiler Collection (BCC)
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{name}
Python3 bindings for BPF Compiler Collection (BCC)
@ -113,6 +111,7 @@ Standalone tool to run BCC tracers written in Lua
%package tools
Summary: Command line tools for BPF Compiler Collection (BCC)
Requires: bcc = %{version}-%{release}
Requires: python3-%{name} = %{version}-%{release}
Requires: python3-netaddr
@ -134,11 +133,10 @@ Command line libbpf tools for BPF Compiler Collection (BCC)
%build
%cmake . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DREVISION_LAST=%{version} -DREVISION=%{version} -DPYTHON_CMD=python3 \
-DCMAKE_USE_LIBBPF_PACKAGE:BOOL=TRUE \
%{?with_llvm_shared:-DENABLE_LLVM_SHARED=1}
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DREVISION_LAST=%{version} -DREVISION=%{version} -DPYTHON_CMD=python3 \
-DCMAKE_USE_LIBBPF_PACKAGE:BOOL=TRUE \
%{?with_llvm_shared:-DENABLE_LLVM_SHARED=1}
%cmake_build
# It was discussed and agreed to package libbpf-tools with
@ -240,6 +238,12 @@ cp -a libbpf-tools/tmp-install/bin/* %{buildroot}/%{_sbindir}/
%endif
%changelog
* Tue Apr 19 2022 Jerome Marchand <jmarchan@redhat.com> - 0.24.0-1
- Rebase to the latest release version
- Fix cmake build
- Add explicit Requires: bcc for bcc-tools
- Remove deprecated python_provide macro
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.22.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

View File

@ -0,0 +1,48 @@
From c353d172e34f93eb281b679ee6ab3e039db0f420 Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Tue, 15 Mar 2022 17:59:24 +0100
Subject: [PATCH] libbpf-tools: Allow to use different cflags for bpf targets
commit 531b698cdc20 ("libbpf-tools: Enable compilation warnings for
BPF programs") applies CFLAGS to all targets. However, some of the c
flags typically used by distribution are not available to the bpf
target. Add a new BPFCFLAGS macro to take care of that.
Fixes the following compilation error on fedora:
BPF bashreadline.bpf.o
clang-13: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
clang-13: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Wunused-command-line-argument]
clang-13: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' [-Wunused-command-line-argument]
clang-13: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]
error: option 'cf-protection=return' cannot be specified on this target
error: option 'cf-protection=branch' cannot be specified on this target
2 errors generated.
---
libbpf-tools/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libbpf-tools/Makefile b/libbpf-tools/Makefile
index faa26139..aba19e00 100644
--- a/libbpf-tools/Makefile
+++ b/libbpf-tools/Makefile
@@ -7,6 +7,7 @@ LIBBPF_SRC := $(abspath ../src/cc/libbpf/src)
LIBBPF_OBJ := $(abspath $(OUTPUT)/libbpf.a)
INCLUDES := -I$(OUTPUT) -I../src/cc/libbpf/include/uapi
CFLAGS := -g -O2 -Wall
+BPFCFLAGS := -g -O2 -Wall
INSTALL ?= install
prefix ?= /usr/local
ARCH := $(shell uname -m | sed 's/x86_64/x86/' | sed 's/aarch64/arm64/' | sed 's/ppc64le/powerpc/' | sed 's/mips.*/mips/')
@@ -107,7 +108,7 @@ $(OUTPUT)/%.skel.h: $(OUTPUT)/%.bpf.o | $(OUTPUT)
$(OUTPUT)/%.bpf.o: %.bpf.c $(LIBBPF_OBJ) $(wildcard %.h) $(ARCH)/vmlinux.h | $(OUTPUT)
$(call msg,BPF,$@)
- $(Q)$(CLANG) $(CFLAGS) -target bpf -D__TARGET_ARCH_$(ARCH) \
+ $(Q)$(CLANG) $(BPFCFLAGS) -target bpf -D__TARGET_ARCH_$(ARCH) \
-I$(ARCH)/ $(INCLUDES) -c $(filter %.c,$^) -o $@ && \
$(LLVM_STRIP) -g $@
--
2.35.1