Re: [PATCH] x86/build: Do not allow X86_NATIVE_CPU to be enabled on non-x86_64 hosts

From: Nathan Chancellor

Date: Sun Nov 15 2026 - 00:07:45 EST


On Sat, Nov 14, 2026 at 12:58:06PM -0800, Borislav Petkov wrote:
> On Sat, Nov 14, 2026 at 01:46:05PM -0700, Nathan Chancellor wrote:
> > No other architectures provide an option to turn on '-march=native' like
> > x86 does. It all lives within arch/x86, so I would just be adding a
> > check to arch/x86/Makefile instead of arch/x86/Kconfig.cpu. Making the
> > option unselectable seems like a better option. If other architectures
> > did want to add this option, I agree generically abstacting this check
> > would be reasonable.
>
> Are you going to move it somewhere generic when other arches decide all of
> a sudden they love the native thing?

Yes, as I would expect another architecture implementing this to
abstract the current x86 support out and adjust that check in the
process but I can't guarantee that. I can only go off of what is
currently in the tree.

> (If it were me, I'd simply whack that native thing. It is such a waste of
> energy).

Another option short of adding this test or killing it entirely would be
depending on !COMPILE_TEST, as I only noticed this because
CONFIG_X86_NATIVE_CPU gets enabled for allmodconfig.

--
Cheers,
Nathan