kbuild: clang: choose GCC_TOOLCHAIN_DIR not on LD
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Wed, 11 Jun 2025 20:24:31 +0000 (23:24 +0300)
committerTom Rini <trini@konsulko.com>
Wed, 11 Jun 2025 22:21:36 +0000 (16:21 -0600)
Backported from kernel
commit ad15006cc784 ("kbuild: clang: choose GCC_TOOLCHAIN_DIR not on LD")

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Makefile

index 7e1b36e..e648f49 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -446,7 +446,7 @@ ifeq ($(cc-name),clang)
 ifneq ($(CROSS_COMPILE),)
 CLANG_TARGET   := --target=$(notdir $(CROSS_COMPILE:%-=%))
 LDPPFLAGS      += $(CLANG_TARGET)
-GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD)))
+GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
 CLANG_PREFIX   := --prefix=$(GCC_TOOLCHAIN_DIR)
 GCC_TOOLCHAIN  := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
 endif