Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* [PATCH v2] kbuild: Reject unexpected values for LLVM=
@ 2026-01-21 13:42 Thomas Weißschuh
  2026-01-21 21:05 ` Nicolas Schier
  2026-01-22  0:03 ` Nathan Chancellor
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2026-01-21 13:42 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt
  Cc: linux-kbuild, linux-kernel, llvm, WangYuli, Thomas Weißschuh

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>
---
Changes in v2:
- Add pointer to the documentation.
- Link to v1: https://patch.msgid.link/20260112-kbuild-llvm-arg-v1-1-8e9bbdae996f@weissschuh.net
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index e404e4767944..4cf187f70171 100644
--- 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)

---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20260111-kbuild-llvm-arg-c7346a4f2b3a

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kbuild: Reject unexpected values for LLVM=
  2026-01-21 13:42 [PATCH v2] kbuild: Reject unexpected values for LLVM= Thomas Weißschuh
@ 2026-01-21 21:05 ` Nicolas Schier
  2026-01-22  0:03 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Schier @ 2026-01-21 21:05 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-kbuild, linux-kernel, llvm, WangYuli

On Wed, Jan 21, 2026 at 02:42:39PM +0100, Thomas Weißschuh wrote:
> 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>
> ---
> Changes in v2:
> - Add pointer to the documentation.
> - Link to v1: https://patch.msgid.link/20260112-kbuild-llvm-arg-v1-1-8e9bbdae996f@weissschuh.net
> ---
>  Makefile | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Nicolas Schier <nsc@kernel.org>
Tested-by: Nicolas Schier <nsc@kernel.org>

-- 
Nicolas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kbuild: Reject unexpected values for LLVM=
  2026-01-21 13:42 [PATCH v2] kbuild: Reject unexpected values for LLVM= Thomas Weißschuh
  2026-01-21 21:05 ` Nicolas Schier
@ 2026-01-22  0:03 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2026-01-22  0:03 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Thomas Weißschuh
  Cc: linux-kbuild, linux-kernel, llvm, WangYuli

On Wed, 21 Jan 2026 14:42:39 +0100, Thomas Weißschuh wrote:
> 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.
> 
> [...]

Applied to

  https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-next

Thanks!

[1/1] kbuild: Reject unexpected values for LLVM=
      https://git.kernel.org/kbuild/c/502678b88cb3b

Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted. Patches applied to an "unstable" branch are accepted pending
wider testing in -next and any post-commit review; they will generally
be moved to the main branch in a week if no issues are found.

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-22  0:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 13:42 [PATCH v2] kbuild: Reject unexpected values for LLVM= Thomas Weißschuh
2026-01-21 21:05 ` Nicolas Schier
2026-01-22  0:03 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox