Skip to content

Commit 0141208

Browse files
author
Ingo Molnar
committed
x86/kbuild/64: Test for the availability of the -mtune=native compiler flag
Stephen reported this build failure when cross-compiling: cc1: error: bad value 'native' for '-march=' switch Test for the availability of the -march=native flag. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Stephen Rothwell <sfr@canb.auug.org.au> # build test Cc: Tor Vic <torvic9@mailbox.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: Juergen Gross <jgross@suse.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20250324172723.49fb0416@canb.auug.org.au
1 parent ea1dcca commit 0141208

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/x86/Kconfig.cpu

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,14 @@ config MATOM
245245

246246
endchoice
247247

248+
config CC_HAS_MARCH_NATIVE
249+
# This flag might not be available in cross-compilers:
250+
def_bool $(cc-option, -march=native)
251+
248252
config X86_NATIVE_CPU
249253
bool "Build and optimize for local/native CPU"
250254
depends on X86_64
251-
default n
255+
depends on CC_HAS_MARCH_NATIVE
252256
help
253257
Optimize for the current CPU used to compile the kernel.
254258
Use this option if you intend to build the kernel for your

0 commit comments

Comments
 (0)