diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 71442c54c25f4f605fded54bd0e47f26009f11c0..16bea51f0bcd95ea46bcea24410aafb6022e1545 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -663,17 +663,14 @@ 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