From: Ian Rogers Date: Mon, 10 Apr 2023 16:09:05 +0000 (-0700) Subject: perf build: Warn for BPF skeletons if endian mismatches X-Git-Tag: v6.6.7~2868^2~113 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51924ae69eea5bc90b5da525fbcf4bbd5f8551b3;p=platform%2Fkernel%2Flinux-starfive.git perf build: Warn for BPF skeletons if endian mismatches Done as a warning as I'm not fully confident of the test's robustness of comparing the macro definition of __BYTE_ORDER__. v2. Is a rebase following patch 1 being merged. Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andrii Nakryiko Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20230410160905.3052640-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 16bea51..71442c5 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -663,14 +663,17 @@ ifndef NO_BPF_SKEL $(call feature_check,clang-bpf-co-re) ifeq ($(feature-clang-bpf-co-re), 0) dummy := $(error: ERROR: BPF skeletons unsupported. clang too old/not installed or build with NO_BPF_SKEL=1.) - else - ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),) - dummy := $(error: ERROR: BPF skeletons unsupported. BPF skeleton support requires libbpf or build with NO_BPF_SKEL=1.) - else - $(call detected,CONFIG_PERF_BPF_SKEL) - CFLAGS += -DHAVE_BPF_SKEL - endif endif + ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),) + dummy := $(error: ERROR: BPF skeletons unsupported. BPF skeleton support requires libbpf or build with NO_BPF_SKEL=1.) + endif + host_byte_order=$(echo ""|$(HOSTCC) -dM -E -|grep __BYTE_ORDER__) + target_byte_order=$(echo ""|$(CC) -dM -E -|grep __BYTE_ORDER__) + ifneq ($(host_byte_order), $(target_byte_order)) + $(warning Possibly mismatched host and target endianness may break BPF skeletons) + endif + $(call detected,CONFIG_PERF_BPF_SKEL) + CFLAGS += -DHAVE_BPF_SKEL endif dwarf-post-unwind := 1