From: Ian Rogers Date: Mon, 16 Jan 2023 01:01:13 +0000 (-0800) Subject: tools build: Pass libbpf feature only if libbpf 1.0+ X-Git-Tag: v6.6.17~4887^2~289 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56d5229471ee1634bd0eb029f1aa82a8d87c6fed;p=platform%2Fkernel%2Flinux-rpi.git tools build: Pass libbpf feature only if libbpf 1.0+ libbpf 1.0 represented a cleanup and stabilization of APIs. Simplify development by only passing the feature test if libbpf 1.0 is installed. Committer notes: Change 'make -C tools/perf build-test' so that the LIBBPF_DYNAMIC=1 test runs only if libbpf is >= 1.0. Signed-off-by: Ian Rogers Tested-by: Jiri Olsa Acked-by: Jiri Olsa Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andres Freund Cc: Andrii Nakryiko Cc: Christy Lee Cc: Ingo Molnar Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Quentin Monnet Cc: Roberto Sassu Cc: bpf@vger.kernel.org Link: https://lore.kernel.org/r/20230116010115.490713-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/build/feature/test-libbpf.c b/tools/build/feature/test-libbpf.c index a508756..cd9989f 100644 --- a/tools/build/feature/test-libbpf.c +++ b/tools/build/feature/test-libbpf.c @@ -1,6 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 #include +#if !defined(LIBBPF_MAJOR_VERSION) || (LIBBPF_MAJOR_VERSION < 1) +#error At least libbpf 1.0 is required for Linux tools. +#endif + int main(void) { return bpf_object__open("test") ? 0 : -1; diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 009d6ef..b4d64fd 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make @@ -150,7 +150,6 @@ run += make_no_libaudit run += make_no_libbionic run += make_no_auxtrace run += make_no_libbpf -run += make_libbpf_dynamic run += make_no_libbpf_DEBUG run += make_no_libcrypto run += make_no_sdt @@ -176,6 +175,12 @@ run += make_install_prefix_slash # run += make_install_pdf run += make_minimal +old_libbpf := $(shell echo "#include " | $(CC) -E -dM -x c -| egrep -q "define[[:space:]]+LIBBPF_MAJOR_VERSION[[:space:]]+0{1}") + +ifneq ($(old_libbpf),) +run += make_libbpf_dynamic +endif + ifneq ($(call has,ctags),) run += make_tags endif