* [PATCH] kbuild: Reject unexpected values for LLVM=
@ 2026-01-12 6:43 Thomas Weißschuh
2026-01-12 6:58 ` WangYuli
2026-01-12 23:16 ` Nathan Chancellor
0 siblings, 2 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-01-12 6:43 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
Bill Wendling, Justin Stitt
Cc: linux-kbuild, linux-kernel, llvm, 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>
---
Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Makefile b/Makefile
index e404e4767944..2a085a1b6875 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=)
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] 5+ messages in thread
* Re: [PATCH] kbuild: Reject unexpected values for LLVM=
2026-01-12 6:43 [PATCH] kbuild: Reject unexpected values for LLVM= Thomas Weißschuh
@ 2026-01-12 6:58 ` WangYuli
2026-01-12 21:37 ` Thomas Weißschuh
2026-01-12 23:16 ` Nathan Chancellor
1 sibling, 1 reply; 5+ messages in thread
From: WangYuli @ 2026-01-12 6:58 UTC (permalink / raw)
To: Thomas Weißschuh, Nathan Chancellor, Nicolas Schier,
Nick Desaulniers, Bill Wendling, Justin Stitt
Cc: linux-kbuild, linux-kernel, llvm
Hi Thomas Weißschuh,
On 2026/1/12 14:43, 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.
>
"Falling back to the system toolchain" may be an acceptable behavior; I
think reporting a warning here rather than an error would be more
appropriate.
Thanks,
--
WangYuli
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kbuild: Reject unexpected values for LLVM=
2026-01-12 6:58 ` WangYuli
@ 2026-01-12 21:37 ` Thomas Weißschuh
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-01-12 21:37 UTC (permalink / raw)
To: WangYuli
Cc: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
Bill Wendling, Justin Stitt, linux-kbuild, linux-kernel, llvm
On 2026-01-12 14:58:08+0800, WangYuli wrote:
> Hi Thomas Weißschuh,
>
> On 2026/1/12 14:43, 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.
> >
> "Falling back to the system toolchain" may be an acceptable behavior; I
> think reporting a warning here rather than an error would be more
> appropriate.
For which value of 'LLVM' would a silent fallback be the thing to do?
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kbuild: Reject unexpected values for LLVM=
2026-01-12 6:43 [PATCH] kbuild: Reject unexpected values for LLVM= Thomas Weißschuh
2026-01-12 6:58 ` WangYuli
@ 2026-01-12 23:16 ` Nathan Chancellor
2026-01-21 12:08 ` Nicolas Schier
1 sibling, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2026-01-12 23:16 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt,
linux-kbuild, linux-kernel, llvm
On Mon, Jan 12, 2026 at 07:43:52AM +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.
Yeah, I do not think falling back to the system toolchain is great here.
This would also catch misuse of LLVM=0, since that is treated as LLVM=1,
rather than reverting to GCC + binutils.
> Instead report an error if the user specified an invalid value for LLVM.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index e404e4767944..2a085a1b6875 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=)
If having a hard error is untenable (I am not sure that it is), we could
just warn. Pointing to Documentation/kbuild/llvm.rst might be worthwhile
in the message as well.
> 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 [flat|nested] 5+ messages in thread
* Re: [PATCH] kbuild: Reject unexpected values for LLVM=
2026-01-12 23:16 ` Nathan Chancellor
@ 2026-01-21 12:08 ` Nicolas Schier
0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2026-01-21 12:08 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Thomas Weißschuh, Nick Desaulniers, Bill Wendling,
Justin Stitt, linux-kbuild, linux-kernel, llvm
On Mon, Jan 12, 2026 at 04:16:24PM -0700, Nathan Chancellor wrote:
> On Mon, Jan 12, 2026 at 07:43:52AM +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.
>
> Yeah, I do not think falling back to the system toolchain is great here.
> This would also catch misuse of LLVM=0, since that is treated as LLVM=1,
> rather than reverting to GCC + binutils.
>
> > Instead report an error if the user specified an invalid value for LLVM.
> >
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > ---
> > Makefile | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index e404e4767944..2a085a1b6875 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=)
>
> If having a hard error is untenable (I am not sure that it is), we could
> just warn. Pointing to Documentation/kbuild/llvm.rst might be worthwhile
> in the message as well.
I second to have a hard error here with the documentation pointer to
prevent building with an unexpected toolchain, and as there is also no
fallback for gcc toolchains.
Kind regards,
Nicolas
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-21 12:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 6:43 [PATCH] kbuild: Reject unexpected values for LLVM= Thomas Weißschuh
2026-01-12 6:58 ` WangYuli
2026-01-12 21:37 ` Thomas Weißschuh
2026-01-12 23:16 ` Nathan Chancellor
2026-01-21 12:08 ` Nicolas Schier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox