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

From: David Laight

Date: Mon Nov 16 2026 - 17:29:11 EST


On Mon, 16 Nov 2026 12:11:20 -0700
Nathan Chancellor <nathan@xxxxxxxxxx> wrote:

> On Mon, Nov 16, 2026 at 10:28:54AM -0800, Nick Desaulniers wrote:
> > On Sat, Nov 14, 2026 at 12:58 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
> > >
> > > (If it were me, I'd simply whack that native thing. It is such a waste of
> > > energy).
> >
> > There's always KCFLAGS. i.e. we _could_ remove it from the x86 build,
> > and <whoever cares> could still do
> >
> > $ make KCFLAGS="-march=native" ...
> >
> > (I'm agreeing with Boris here)
>
> I have no objections to deleting X86_NATIVE_CPU but as Ingo notes in the
> v2, people do use this and it is much more convenient for a regular user
> to adjust this single configuration option in their local configuration
> file than fiddling with KCFLAGS (potentially having to modify their
> distribution's packaging file in the process).

It would certainly also be nice to put something in the .config file
(or at least in the obj directory) that selects the correct compiler
for the kernel being built.
Otherwise it is easy to forget to request a cross compiler (etc).
(Maybe there is - but I've not found it.)

David

>
> > Nathan,
> > Was there a bug on file against clang for this? I can picture a fix
> > in my head for this...
>
> I am not sure I ever found one. I can file one later today.
>