kernel: Check HIP support of clang before disabling it
Old clang releases don't support --hip-path, so passing this flag will
break the build.
Change-Id: If36defb0e74893581849700fb67e6aa4617908a8
diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk
index 80a895f..9189864 100644
--- a/build/tasks/kernel.mk
+++ b/build/tasks/kernel.mk
@@ -239,7 +239,11 @@
endif
PATH_OVERRIDE += PATH=$(TARGET_KERNEL_CLANG_PATH)/bin:$$PATH
ifeq ($(KERNEL_CC),)
- KERNEL_CC := CC="$(CCACHE_BIN) clang --cuda-path=/dev/null --hip-path=/dev/null"
+ CLANG_EXTRA_FLAGS := --cuda-path=/dev/null
+ ifeq ($(shell $(TARGET_KERNEL_CLANG_PATH)/bin/clang -v --hip-path=/dev/null >/dev/null 2>&1; echo $$?),0)
+ CLANG_EXTRA_FLAGS += --hip-path=/dev/null
+ endif
+ KERNEL_CC := CC="$(CCACHE_BIN) clang $(CLANG_EXTRA_FLAGS)"
endif
endif