Skip to contentSkip to conversation

linux-next: build failure after merge of the tip tree

PATCH In review Stephen Rothwell 4 participants 7 messages Mar 24, 2025 – Apr 3, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) failed like this:

cc1: error: bad value 'native' for '-march=' switch
cc1: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids emeraldrapids alderlake raptorlake meteorlake graniterapids graniterapids-d arrowlake arrowlake-s lunarlake pantherlake bonnell atom silvermont slm goldmont goldmont-plus tremont gracemont sierraforest grandridge clearwaterforest knl knm x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 lujiazui yongfeng k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 znver4 znver5 btver1 btver2 make[3]: *** [scripts/Makefile.build:203: scripts/mod/empty.o] Error 1
cc1: error: bad value 'native' for '-march=' switch
cc1: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids emeraldrapids alderlake raptorlake meteorlake graniterapids graniterapids-d arrowlake arrowlake-s lunarlake pantherlake bonnell atom silvermont slm goldmont goldmont-plus tremont gracemont sierraforest grandridge clearwaterforest knl knm x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 lujiazui yongfeng k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 znver4 znver5 btver1 btver2 make[3]: *** [scripts/Makefile.build:98: scripts/mod/devicetable-offsets.s] Error 1
make[2]: *** [Makefile:1276: prepare0] Error 2

Caused by commit

0480bc7e65dc ("x86/kbuild/64: Add the CONFIG_X86_NATIVE_CPU option to locally optimize the kernel with '-march=native'")

I have reverted that commit for today.

$ x86_64-linux-gnu-gcc --version
x86_64-linux-gnu-gcc (Debian 14.2.0-12) 14.2.0

cross build - ppc hosted

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 15 lines · Stephen Rothwell

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig) failed like this:

cc1: error: bad value 'native' for '-march=' switch
cc1: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids emeraldrapids alderlake raptorlake meteorlake graniterapids graniterapids-d arrowlake arrowlake-s lunarlake pantherlake bonnell atom silvermont slm goldmont goldmont-plus tremont gracemont sierraforest grandridge clearwaterforest knl knm x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 lujiazui yongfeng k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 znver4 znver5 btver1 btver2 make[3]: *** [scripts/Makefile.build:203: scripts/mod/empty.o] Error 1
cc1: error: bad value 'native' for '-march=' switch
cc1: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids emeraldrapids alderlake raptorlake meteorlake graniterapids graniterapids-d arrowlake arrowlake-s lunarlake pantherlake bonnell atom silvermont slm goldmont goldmont-plus tremont gracemont sierraforest grandridge clearwaterforest knl knm x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 lujiazui yongfeng k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 znver4 znver5 btver1 btver2 make[3]: *** [scripts/Makefile.build:98: scripts/mod/devicetable-offsets.s] Error 1
make[2]: *** [Makefile:1276: prepare0] Error 2

Caused by commit

Quoted 9 lines

0480bc7e65dc ("x86/kbuild/64: Add the CONFIG_X86_NATIVE_CPU option to locally optimize the kernel with '-march=native'")

I have reverted that commit for today.

$ 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?

#2 lore raw

Hi,

Quoted 8 lines · On Sun, 23 Mar 2025 23:29:20 -0700 "H. Peter Anvin" <[email protected]> wrote:
Quoted 6 lines
$ 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 :-))

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw

PATCH 1/1 x86/kbuild/64: Test for the availability of the -mtune=native compiler flag

Quoted 7 lines · Stephen Rothwell

Hi,

Quoted 4 lines · On Sun, 23 Mar 2025 23:29:20 -0700 "H. Peter Anvin" <[email protected]> wrote:
Quoted 4 lines
$ x86_64-linux-gnu-gcc --version
x86_64-linux-gnu-gcc (Debian 14.2.0-12) 14.2.0
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

cross build - ppc hosted

Cross compiling?

Yes (see above :-))

Does the patch below fix the bug?

Thanks,

Ingo

=====================>
From: Ingo Molnar <[email protected]>
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.

---
 arch/x86/Kconfig.cpu | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/Kconfig.cpu +5 -1
index 9d108a54c30a..87bede96e800 100644
@@ -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
merge bot Applied
#6 lore raw

[tip: x86/kconfig] x86/kbuild/64: Test for the availability of the -mtune=native compiler flag

In reply to Stephen Rothwell
The following commit has been merged into the x86/kconfig branch of tip:

The following commit has been merged into the x86/kconfig branch of tip:

Commit-ID:     01412081863aa81db47423d5719f2726d2a00a32
Gitweb:        https://git.kernel.org/tip/01412081863aa81db47423d5719f2726d2a00a32
Author:        Ingo Molnar <[email protected]>
AuthorDate:    Mon, 24 Mar 2025 08:05:19 +01:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Tue, 25 Mar 2025 08:24:06 +01:00

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.

---
 arch/x86/Kconfig.cpu | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/Kconfig.cpu +5 -1
index 9d108a5..87bede9 100644
@@ -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