mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
perf build: Filter out BTF sources without a .BTF section
If generating vmlinux.h, make the code to generate it more tolerant by filtering out paths to kernels that lack a .BTF section. Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: James Clark <james.clark@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Yang Jihong <yangjihong1@huawei.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Tiezhu Yang <yangtiezhu@loongson.cn> Cc: Ingo Molnar <mingo@redhat.com> Cc: bpf@vger.kernel.org Link: https://lore.kernel.org/r/20230623041405.4039475-5-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -199,6 +199,7 @@ FLEX ?= flex
|
|||||||
BISON ?= bison
|
BISON ?= bison
|
||||||
STRIP = strip
|
STRIP = strip
|
||||||
AWK = awk
|
AWK = awk
|
||||||
|
READELF ?= readelf
|
||||||
|
|
||||||
# include Makefile.config by default and rule out
|
# include Makefile.config by default and rule out
|
||||||
# non-config cases
|
# non-config cases
|
||||||
@@ -1086,12 +1087,34 @@ $(BPFTOOL): | $(SKEL_TMP_OUT)
|
|||||||
$(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
|
$(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
|
||||||
OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
|
OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
|
||||||
|
|
||||||
VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux) \
|
# Paths to search for a kernel to generate vmlinux.h from.
|
||||||
|
VMLINUX_BTF_ELF_PATHS ?= $(if $(O),$(O)/vmlinux) \
|
||||||
$(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
|
$(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux) \
|
||||||
../../vmlinux \
|
../../vmlinux \
|
||||||
/sys/kernel/btf/vmlinux \
|
|
||||||
/boot/vmlinux-$(shell uname -r)
|
/boot/vmlinux-$(shell uname -r)
|
||||||
VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
|
|
||||||
|
# Paths to BTF information.
|
||||||
|
VMLINUX_BTF_BTF_PATHS ?= /sys/kernel/btf/vmlinux
|
||||||
|
|
||||||
|
# Filter out kernels that don't exist or without a BTF section.
|
||||||
|
VMLINUX_BTF_ELF_ABSPATHS ?= $(abspath $(wildcard $(VMLINUX_BTF_ELF_PATHS)))
|
||||||
|
VMLINUX_BTF_PATHS ?= $(shell for file in $(VMLINUX_BTF_ELF_ABSPATHS); \
|
||||||
|
do \
|
||||||
|
if [ -f $$file ] && ($(READELF) -S "$$file" | grep -q .BTF); \
|
||||||
|
then \
|
||||||
|
echo "$$file"; \
|
||||||
|
fi; \
|
||||||
|
done) \
|
||||||
|
$(wildcard $(VMLINUX_BTF_BTF_PATHS))
|
||||||
|
|
||||||
|
# Select the first as the source of vmlinux.h.
|
||||||
|
VMLINUX_BTF ?= $(firstword $(VMLINUX_BTF_PATHS))
|
||||||
|
|
||||||
|
ifeq ($(VMLINUX_H),)
|
||||||
|
ifeq ($(VMLINUX_BTF),)
|
||||||
|
$(error Missing bpftool input for generating vmlinux.h)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)
|
$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)
|
||||||
ifeq ($(VMLINUX_H),)
|
ifeq ($(VMLINUX_H),)
|
||||||
|
Reference in New Issue
Block a user