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

From: Nathan Chancellor

Date: Sat Nov 14 2026 - 15:46:22 EST


On Sat, Nov 14, 2026 at 12:25:24PM -0800, Borislav Petkov wrote:
> This looks like a whack-a-mole-y fix to me. Especially if the other arches
> would have the same problem.

I made that comment more about the different architecture
implementations in the clang driver but I guess it could apply to the
kernel as well. However...

> So wouldn't a more generic fix checking
>
> native arch == target arch
>
> somewhere in the makefile be better?

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.

--
Cheers,
Nathan