aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2022-10-26 23:05:31 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2022-10-31 00:46:55 +0100
commitc58177b5dcb3461efef0adefe570dd8a8d966ec4 (patch)
treeecf9270585b2c8dcdd40b8f9026937c8f5180d9d
parent95c216806b2520d5638b500f61d3788e8ecbabc9 (diff)
downloadupstream-c58177b5dcb3461efef0adefe570dd8a8d966ec4.tar.gz
upstream-c58177b5dcb3461efef0adefe570dd8a8d966ec4.tar.bz2
upstream-c58177b5dcb3461efef0adefe570dd8a8d966ec4.zip
bpf: check llvm version only when used
unetd always includes $(INCLUDE_DIR)/bpf.mk. This file always checks if the LLVM version is supported in CLANG_VER_VALID. unetd only needs bpf when UNETD_VXLAN_SUPPORT is set. It fails when UNETD_VXLAN_SUPPORT is not set and llvm is not installed. Fix it by only checking the LLVM version when a LLVM toolchain is available. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--include/bpf.mk2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/bpf.mk b/include/bpf.mk
index 7d0cfbd76d..e43fcad50c 100644
--- a/include/bpf.mk
+++ b/include/bpf.mk
@@ -63,6 +63,7 @@ BPF_CFLAGS := \
-Wno-unused-label \
-O2 -emit-llvm -Xclang -disable-llvm-passes
+ifneq ($(CONFIG_HAS_BPF_TOOLCHAIN),)
ifeq ($(DUMP),)
CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3)
CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 )
@@ -70,6 +71,7 @@ ifeq ($(DUMP),)
$(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER))
endif
endif
+endif
define CompileBPF
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \