]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kbuild: Reject unexpected values for LLVM=
authorThomas Weißschuh <linux@weissschuh.net>
Wed, 21 Jan 2026 13:42:39 +0000 (14:42 +0100)
committerNathan Chancellor <nathan@kernel.org>
Thu, 22 Jan 2026 00:01:30 +0000 (17:01 -0700)
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: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Tested-by: Nicolas Schier <nsc@kernel.org>
Link: https://patch.msgid.link/20260121-kbuild-llvm-arg-v2-1-5e4d8dca4ad8@weissschuh.net
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Makefile

index 362df202fb8a885fc04d93e363e65819c2c3cdfc..93831019c17b937a8ff619d08ffa0bbf3f1252e5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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)