All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: improve sanity check for ARCH variable on x86
@ 2026-10-20  0:17 Cao Jin
  2026-10-20  0:36 ` Nathan Chancellor
  2026-10-20  1:38 ` Randy Dunlap
  0 siblings, 2 replies; 8+ messages in thread
From: Cao Jin @ 2026-10-20  0:17 UTC (permalink / raw)
  To: nathan, nsc; +Cc: linux-kbuild, Cao Jin

When building for x86, ARCH=i{4,5,6}86 and x86_32 will fail the build.
Make it catch all name variants.
---
 Makefile | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 7c855e6fe544..cd397027891a 100644
--- a/Makefile
+++ b/Makefile
@@ -409,12 +409,10 @@ ARCH		?= $(SUBARCH)
 UTS_MACHINE 	:= $(ARCH)
 SRCARCH 	:= $(ARCH)
 
-# Additional ARCH settings for x86
-ifeq ($(ARCH),i386)
-        SRCARCH := x86
-endif
-ifeq ($(ARCH),x86_64)
-        SRCARCH := x86
+# Additional sanity check for cmdline ARCH settings for x86. This catch
+# more name variants than "i386" and "x86_64".
+ifneq ($(findstring 86,$(ARCH)),)
+    SRCARCH := x86
 endif
 
 # Additional ARCH settings for sparc
-- 
2.55.0


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

* Re: [PATCH] kbuild: improve sanity check for ARCH variable on x86
  2026-10-20  0:17 [PATCH] kbuild: improve sanity check for ARCH variable on x86 Cao Jin
@ 2026-10-20  0:36 ` Nathan Chancellor
  2026-10-20  0:59   ` Borislav Petkov
  2026-10-20  1:33   ` Cao Jin
  2026-10-20  1:38 ` Randy Dunlap
  1 sibling, 2 replies; 8+ messages in thread
From: Nathan Chancellor @ 2026-10-20  0:36 UTC (permalink / raw)
  To: Cao Jin; +Cc: nsc, linux-kbuild, x86

On Mon, Oct 19, 2026 at 05:17:38PM -0700, Cao Jin wrote:
> When building for x86, ARCH=i{4,5,6}86 and x86_32 will fail the build.

Thanks for the patch. Where is it documented that these other options
are valid? It seems like this is just expected behavior because these
are not valid values for setting ARCH for x86. At the very least, I
think something like this needs to be acked by the x86 folks.

> Make it catch all name variants.

You are missing a sign off.

> ---
>  Makefile | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 7c855e6fe544..cd397027891a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -409,12 +409,10 @@ ARCH		?= $(SUBARCH)
>  UTS_MACHINE 	:= $(ARCH)
>  SRCARCH 	:= $(ARCH)
>  
> -# Additional ARCH settings for x86
> -ifeq ($(ARCH),i386)
> -        SRCARCH := x86
> -endif
> -ifeq ($(ARCH),x86_64)
> -        SRCARCH := x86
> +# Additional sanity check for cmdline ARCH settings for x86. This catch
> +# more name variants than "i386" and "x86_64".
> +ifneq ($(findstring 86,$(ARCH)),)
> +    SRCARCH := x86
>  endif
>  
>  # Additional ARCH settings for sparc
> -- 
> 2.55.0
> 

-- 
Cheers,
Nathan

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

* Re: [PATCH] kbuild: improve sanity check for ARCH variable on x86
  2026-10-20  0:36 ` Nathan Chancellor
@ 2026-10-20  0:59   ` Borislav Petkov
  2026-10-20  1:26     ` Cao Jin
  2026-10-20  1:33   ` Cao Jin
  1 sibling, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2026-10-20  0:59 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: Cao Jin, nsc, linux-kbuild, x86

On Mon, Oct 19, 2026 at 05:36:25PM -0700, Nathan Chancellor wrote:
> On Mon, Oct 19, 2026 at 05:17:38PM -0700, Cao Jin wrote:
> > When building for x86, ARCH=i{4,5,6}86 and x86_32 will fail the build.
> 
> Thanks for the patch. Where is it documented that these other options
> are valid? It seems like this is just expected behavior because these
> are not valid values for setting ARCH for x86. At the very least, I
> think something like this needs to be acked by the x86 folks.

I hardly doubt that it'll ever be without a proper explanation why.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

* Re: [PATCH] kbuild: improve sanity check for ARCH variable on x86
  2026-10-20  0:59   ` Borislav Petkov
@ 2026-10-20  1:26     ` Cao Jin
  0 siblings, 0 replies; 8+ messages in thread
From: Cao Jin @ 2026-10-20  1:26 UTC (permalink / raw)
  To: Borislav Petkov, Nathan Chancellor; +Cc: nsc, linux-kbuild, x86

Thank you both for prompt response.

I don't think there is document for it, and my rule of thumb tell me 
that all of i{3,4,5,6}86 & x86_32 represent 32-bit x86(unless I am 
wrong). A young developer may try any of those values at cmdline when 
building 32-bit x86 if he doesn't know the nuance among these value.

On 10/19/26 5:59 PM, Borislav Petkov wrote:
> On Mon, Oct 19, 2026 at 05:36:25PM -0700, Nathan Chancellor wrote:
>> On Mon, Oct 19, 2026 at 05:17:38PM -0700, Cao Jin wrote:
>>> When building for x86, ARCH=i{4,5,6}86 and x86_32 will fail the build.
>>
>> Thanks for the patch. Where is it documented that these other options
>> are valid? It seems like this is just expected behavior because these
>> are not valid values for setting ARCH for x86. At the very least, I
>> think something like this needs to be acked by the x86 folks.
> 
> I hardly doubt that it'll ever be without a proper explanation why.
> 


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

* Re: [PATCH] kbuild: improve sanity check for ARCH variable on x86
  2026-10-20  0:36 ` Nathan Chancellor
  2026-10-20  0:59   ` Borislav Petkov
@ 2026-10-20  1:33   ` Cao Jin
  2026-10-20  1:39     ` Randy Dunlap
  1 sibling, 1 reply; 8+ messages in thread
From: Cao Jin @ 2026-10-20  1:33 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: nsc, linux-kbuild, x86



On 10/19/26 5:36 PM, Nathan Chancellor wrote:
> On Mon, Oct 19, 2026 at 05:17:38PM -0700, Cao Jin wrote:
>> When building for x86, ARCH=i{4,5,6}86 and x86_32 will fail the build.
> 
> Thanks for the patch. Where is it documented that these other options
> are valid? It seems like this is just expected behavior because these
> are not valid values for setting ARCH for x86. At the very least, I
> think something like this needs to be acked by the x86 folks.
> 

Forget to mention, "i386" & "x86_64" are not valid value for ARCH for 
x86 either, the top Makefile correct them to "x86". So we may want to 
correct all other possible invalid value for x86 ARCH, if my 
understanding of i{3,4,5,6}86 are the same for 32-bit x86 were right.


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

* Re: [PATCH] kbuild: improve sanity check for ARCH variable on x86
  2026-10-20  0:17 [PATCH] kbuild: improve sanity check for ARCH variable on x86 Cao Jin
  2026-10-20  0:36 ` Nathan Chancellor
@ 2026-10-20  1:38 ` Randy Dunlap
  2026-10-20  1:51   ` Cao Jin
  1 sibling, 1 reply; 8+ messages in thread
From: Randy Dunlap @ 2026-10-20  1:38 UTC (permalink / raw)
  To: Cao Jin, nathan, nsc; +Cc: linux-kbuild



On 10/19/26 5:17 PM, Cao Jin wrote:
> When building for x86, ARCH=i{4,5,6}86 and x86_32 will fail the build.
> Make it catch all name variants.
> ---
>  Makefile | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 7c855e6fe544..cd397027891a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -409,12 +409,10 @@ ARCH		?= $(SUBARCH)
>  UTS_MACHINE 	:= $(ARCH)
>  SRCARCH 	:= $(ARCH)
>  
> -# Additional ARCH settings for x86
> -ifeq ($(ARCH),i386)
> -        SRCARCH := x86
> -endif
> -ifeq ($(ARCH),x86_64)
> -        SRCARCH := x86
> +# Additional sanity check for cmdline ARCH settings for x86. This catch
> +# more name variants than "i386" and "x86_64".
> +ifneq ($(findstring 86,$(ARCH)),)
> +    SRCARCH := x86
>  endif
>  
>  # Additional ARCH settings for sparc

From Documentation/kbuild/kbuild.rst:

ARCH
----
Set ARCH to the architecture to be built.

In most cases the name of the architecture is the same as the
directory name found in the arch/ directory.

But some architectures such as x86 and sparc have aliases.

- x86: i386 for 32 bit, x86_64 for 64 bit
- parisc: parisc64 for 64 bit
- sparc: sparc32 for 32 bit, sparc64 for 64 bit

-- 
~Randy


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

* Re: [PATCH] kbuild: improve sanity check for ARCH variable on x86
  2026-10-20  1:33   ` Cao Jin
@ 2026-10-20  1:39     ` Randy Dunlap
  0 siblings, 0 replies; 8+ messages in thread
From: Randy Dunlap @ 2026-10-20  1:39 UTC (permalink / raw)
  To: Cao Jin, Nathan Chancellor; +Cc: nsc, linux-kbuild, x86



On 10/19/26 6:33 PM, Cao Jin wrote:
> 
> 
> On 10/19/26 5:36 PM, Nathan Chancellor wrote:
>> On Mon, Oct 19, 2026 at 05:17:38PM -0700, Cao Jin wrote:
>>> When building for x86, ARCH=i{4,5,6}86 and x86_32 will fail the build.
>>
>> Thanks for the patch. Where is it documented that these other options
>> are valid? It seems like this is just expected behavior because these
>> are not valid values for setting ARCH for x86. At the very least, I
>> think something like this needs to be acked by the x86 folks.
>>
> 
> Forget to mention, "i386" & "x86_64" are not valid value for ARCH for x86 either, the top Makefile correct them to "x86". So we may want to correct all other possible invalid value for x86 ARCH, if my understanding of i{3,4,5,6}86 are the same for 32-bit x86 were right.

They are documented aliases for x86.

-- 
~Randy


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

* Re: [PATCH] kbuild: improve sanity check for ARCH variable on x86
  2026-10-20  1:38 ` Randy Dunlap
@ 2026-10-20  1:51   ` Cao Jin
  0 siblings, 0 replies; 8+ messages in thread
From: Cao Jin @ 2026-10-20  1:51 UTC (permalink / raw)
  To: Randy Dunlap, nathan, nsc; +Cc: linux-kbuild



On 10/19/26 6:38 PM, Randy Dunlap wrote:
> 

> 
>  From Documentation/kbuild/kbuild.rst:
> 
> ARCH
> ----
> Set ARCH to the architecture to be built.
> 
> In most cases the name of the architecture is the same as the
> directory name found in the arch/ directory.
> 
> But some architectures such as x86 and sparc have aliases.
> 
> - x86: i386 for 32 bit, x86_64 for 64 bit
> - parisc: parisc64 for 64 bit
> - sparc: sparc32 for 32 bit, sparc64 for 64 bit
> 
I see. Thank you.
Sorry for the noise.

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

end of thread, other threads:[~2026-10-20  1:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20  0:17 [PATCH] kbuild: improve sanity check for ARCH variable on x86 Cao Jin
2026-10-20  0:36 ` Nathan Chancellor
2026-10-20  0:59   ` Borislav Petkov
2026-10-20  1:26     ` Cao Jin
2026-10-20  1:33   ` Cao Jin
2026-10-20  1:39     ` Randy Dunlap
2026-10-20  1:38 ` Randy Dunlap
2026-10-20  1:51   ` Cao Jin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.