Skip to content

Commit 51924ae

Browse files
captain5050acmel
authored andcommitted
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 <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20230410160905.3052640-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent ea0c523 commit 51924ae

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tools/perf/Makefile.config

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -663,14 +663,17 @@ ifndef NO_BPF_SKEL
663663
$(call feature_check,clang-bpf-co-re)
664664
ifeq ($(feature-clang-bpf-co-re), 0)
665665
dummy := $(error: ERROR: BPF skeletons unsupported. clang too old/not installed or build with NO_BPF_SKEL=1.)
666-
else
667-
ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
668-
dummy := $(error: ERROR: BPF skeletons unsupported. BPF skeleton support requires libbpf or build with NO_BPF_SKEL=1.)
669-
else
670-
$(call detected,CONFIG_PERF_BPF_SKEL)
671-
CFLAGS += -DHAVE_BPF_SKEL
672-
endif
673666
endif
667+
ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
668+
dummy := $(error: ERROR: BPF skeletons unsupported. BPF skeleton support requires libbpf or build with NO_BPF_SKEL=1.)
669+
endif
670+
host_byte_order=$(echo ""|$(HOSTCC) -dM -E -|grep __BYTE_ORDER__)
671+
target_byte_order=$(echo ""|$(CC) -dM -E -|grep __BYTE_ORDER__)
672+
ifneq ($(host_byte_order), $(target_byte_order))
673+
$(warning Possibly mismatched host and target endianness may break BPF skeletons)
674+
endif
675+
$(call detected,CONFIG_PERF_BPF_SKEL)
676+
CFLAGS += -DHAVE_BPF_SKEL
674677
endif
675678

676679
dwarf-post-unwind := 1

0 commit comments

Comments
 (0)