Unverified Commit 502678b8 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Nathan Chancellor
Browse files

kbuild: Reject unexpected values for LLVM=



The LLVM argument is documented to accept one of three forms:
* a literal '1' to use the default 'clang',
* a toolchain prefix path, ending in a trailing '/',
* a version suffix.

All other values are silently treated as '1'. If for example
the user accidentally forgets the trailing '/' of a toolchain prefix,
kbuild will unexpectedly and silently fall back to the system toolchain.

Instead report an error if the user specified an invalid value for LLVM.

Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
Reviewed-by: default avatarNicolas Schier <nsc@kernel.org>
Tested-by: default avatarNicolas Schier <nsc@kernel.org>
Link: https://patch.msgid.link/20260121-kbuild-llvm-arg-v2-1-5e4d8dca4ad8@weissschuh.net


Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
parent 301a02d4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -447,6 +447,8 @@ ifneq ($(filter %/,$(LLVM)),)
LLVM_PREFIX := $(LLVM)
else ifneq ($(filter -%,$(LLVM)),)
LLVM_SUFFIX := $(LLVM)
else ifneq ($(LLVM),1)
$(error Invalid value for LLVM, see Documentation/kbuild/llvm.rst)
endif

HOSTCC	= $(LLVM_PREFIX)clang$(LLVM_SUFFIX)