Blame SOURCES/bcc-0.24.0-libbpf-tools-Allow-to-use-different-cflags-for-bpf-t.patch

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