arch/x86/Kconfig.cpu | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
* Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Hi,
>
> On Sun, 23 Mar 2025 23:29:20 -0700 "H. Peter Anvin" <hpa@zytor.com> wrote:
> >
> > >$ x86_64-linux-gnu-gcc --version
> > >x86_64-linux-gnu-gcc (Debian 14.2.0-12) 14.2.0
> > >
> > >cross build - ppc hosted
> > >
> >
> > Cross compiling?
>
> Yes (see above :-))
Does the patch below fix the bug?
Thanks,
Ingo
=====================>
From: Ingo Molnar <mingo@kernel.org>
Date: Mon, 24 Mar 2025 08:05:19 +0100
Subject: [PATCH] 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>
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
---
arch/x86/Kconfig.cpu | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 9d108a54c30a..87bede96e800 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -245,10 +245,14 @@ config MATOM
endchoice
+config CC_HAS_MARCH_NATIVE
+ # This flag might not be available in cross-compilers:
+ def_bool $(cc-option, -march=native)
+
config X86_NATIVE_CPU
bool "Build and optimize for local/native CPU"
depends on X86_64
- default n
+ depends on CC_HAS_MARCH_NATIVE
help
Optimize for the current CPU used to compile the kernel.
Use this option if you intend to build the kernel for your
Hi Ingo, On Mon, 24 Mar 2025 08:10:00 +0100 Ingo Molnar <mingo@kernel.org> wrote: > > Does the patch below fix the bug? Yes, it does. Thanks. Tested-by: Stephen Rothwell <sfr@canb.auug.org.au> # build test -- Cheers, Stephen Rothwell
* Stephen Rothwell <sfr@canb.auug.org.au> wrote: > Hi Ingo, > > On Mon, 24 Mar 2025 08:10:00 +0100 Ingo Molnar <mingo@kernel.org> wrote: > > > > Does the patch below fix the bug? > > Yes, it does. Thanks. > > Tested-by: Stephen Rothwell <sfr@canb.auug.org.au> # build test Thank you! Ingo
© 2016 - 2025 Red Hat, Inc.