Skip to contentSkip to conversation

package/python3: make SuperH tweak actually effective

PATCH Applied Thomas Petazzoni via buildroot 1 participant 5 messages Dec 14, 2025 – Jan 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/python3: make SuperH tweak actually effective

In commit a68899d49ec4c7f97dea0dcb9995e6a5d7b282c9 ("package/python3:
work around GCC bug 121567"), we introduced a work around for a gcc bug, by reducing to -O1 the optimization level on SuperH.

However, it turns out that this is not sufficient, as the build will only succeeded at -O0.

Fixes:

https://autobuild.buildroot.net/results/31f/31f34a983036b4135c12e5797b5c2258ab33e6c2/

Which is a config with BR2_OPTIMIZE_2=y, which means BR2_TOOLCHAIN_HAS_GCC_BUG_121567=y, and therefore -O1 is passed, but still the build fails. At -O0 the build doesn't fail.

---
 package/python3/python3.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/python3/python3.mk +1 -1
index 0189a505b4..4e660ecee2 100644
@@ -192,7 +192,7 @@ endif
 PYTHON3_CFLAGS = $(TARGET_CFLAGS)
 
 ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_121567),y)
-PYTHON3_CFLAGS += -O1
+PYTHON3_CFLAGS += -O0
 endif
 
 PYTHON3_CONF_ENV += \
Signature · 6 lines
2.52.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 toolchain/Config.in: drop BR2_TOOLCHAIN_HAS_GCC_BUG_121567

GCC bug 121567 is actually a duplicate of GCC bug 81426, which already existed upstream, and for which we already had BR2_TOOLCHAIN_HAS_GCC_BUG_81246.

In addition, BR2_TOOLCHAIN_HAS_GCC_BUG_81246 is correctly defined as affecting SuperH regardless of the optimization level. Indeed, when BR2_TOOLCHAIN_HAS_GCC_BUG_121567 was introduced, it was thought that only -O2 and -O3 levels are affected, but -Og, -O1 and -Ofast are also affected, causing the python3 build to fail.

Fixes:

https://autobuild.buildroot.net/results/aca1812415ee84eef223b0fdff88f31a39775294/ (-O1 build)

https://autobuild.buildroot.net/results/3fd91ce3ff8727d2f9c12f6721df922c60282d70/ (-Ofast build)

https://autobuild.buildroot.net/results/e5536dcf598a51f5006343513a76f4e223e80a55/ (-Og build)

---
 package/python3/python3.mk |  2 +-
 toolchain/Config.in        | 13 +++----------
 2 files changed, 4 insertions(+), 11 deletions(-)
package/python3/python3.mk +1 -1
index 4e660ecee2..0690678c04 100644
@@ -191,7 +191,7 @@ endif
 
 PYTHON3_CFLAGS = $(TARGET_CFLAGS)
 
-ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_121567),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_81426),y)
 PYTHON3_CFLAGS += -O0
 endif
 
toolchain/Config.in +3 -10
index 8330e652c2..99337a1873 100644
@@ -141,6 +141,9 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
 	default y if BR2_microblaze
 
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81426
+# error: unable to find a register to spill in class ‘R0_REGS’
+# The bug exists at least since gcc 6.x, so we are assuming it affects
+# all GCC versions.
 config BR2_TOOLCHAIN_HAS_GCC_BUG_81426
 	bool
 	default y if BR2_sh
@@ -243,16 +246,6 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_111001
 		   BR2_OPTIMIZE_2 || \
 		   BR2_OPTIMIZE_3
 
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121567
-# error: unable to find a register to spill in class ‘R0_REGS’
-# The bug exists at least since gcc 6.x, so we are assuming it affects
-# all GCC versions.
-config BR2_TOOLCHAIN_HAS_GCC_BUG_121567
-	bool
-	default y if BR2_sh
-	depends on BR2_OPTIMIZE_2 || \
-		   BR2_OPTIMIZE_3
-
 config BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	bool
 
Signature · 6 lines
2.52.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/2] toolchain/Config.in: drop BR2_TOOLCHAIN_HAS_GCC_BUG_121567

In reply of:

Quoted 12 lines

GCC bug 121567 is actually a duplicate of GCC bug 81426, which already existed upstream, and for which we already had BR2_TOOLCHAIN_HAS_GCC_BUG_81246.

In addition, BR2_TOOLCHAIN_HAS_GCC_BUG_81246 is correctly defined as affecting SuperH regardless of the optimization level. Indeed, when BR2_TOOLCHAIN_HAS_GCC_BUG_121567 was introduced, it was thought that only -O2 and -O3 levels are affected, but -Og, -O1 and -Ofast are also affected, causing the python3 build to fail.

Fixes:

Quoted 7 lines

https://autobuild.buildroot.net/results/aca1812415ee84eef223b0fdff88f31a39775294/ (-O1 build)

https://autobuild.buildroot.net/results/3fd91ce3ff8727d2f9c12f6721df922c60282d70/ (-Ofast build)

https://autobuild.buildroot.net/results/e5536dcf598a51f5006343513a76f4e223e80a55/ (-Og build)

Applied to 2025.11.x. Thanks

Quoted 56 lines
---
 package/python3/python3.mk |  2 +-
 toolchain/Config.in        | 13 +++----------
 2 files changed, 4 insertions(+), 11 deletions(-)
package/python3/python3.mk +1 -1
index 4e660ecee2..0690678c04 100644
@@ -191,7 +191,7 @@ endif
 
 PYTHON3_CFLAGS = $(TARGET_CFLAGS)
 
-ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_121567),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_81426),y)
 PYTHON3_CFLAGS += -O0
 endif
 
toolchain/Config.in +3 -10
index 8330e652c2..99337a1873 100644
@@ -141,6 +141,9 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
 	default y if BR2_microblaze
 
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81426
+# error: unable to find a register to spill in class ‘R0_REGS’
+# The bug exists at least since gcc 6.x, so we are assuming it affects
+# all GCC versions.
 config BR2_TOOLCHAIN_HAS_GCC_BUG_81426
 	bool
 	default y if BR2_sh
@@ -243,16 +246,6 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_111001
 		   BR2_OPTIMIZE_2 || \
 		   BR2_OPTIMIZE_3
 
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121567
-# error: unable to find a register to spill in class ‘R0_REGS’
-# The bug exists at least since gcc 6.x, so we are assuming it affects
-# all GCC versions.
-config BR2_TOOLCHAIN_HAS_GCC_BUG_121567
-	bool
-	default y if BR2_sh
-	depends on BR2_OPTIMIZE_2 || \
-		   BR2_OPTIMIZE_3
-
 config BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	bool
 
Signature · 6 lines
2.52.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 10 lines · Thomas Petazzoni via buildroot

In commit a68899d49ec4c7f97dea0dcb9995e6a5d7b282c9 ("package/python3:
work around GCC bug 121567"), we introduced a work around for a gcc bug, by reducing to -O1 the optimization level on SuperH.

However, it turns out that this is not sufficient, as the build will only succeeded at -O0.

Fixes:

Quoted 7 lines

https://autobuild.buildroot.net/results/31f/31f34a983036b4135c12e5797b5c2258ab33e6c2/

Which is a config with BR2_OPTIMIZE_2=y, which means BR2_TOOLCHAIN_HAS_GCC_BUG_121567=y, and therefore -O1 is passed, but still the build fails. At -O0 the build doesn't fail.

Series applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Thomas Petazzoni via buildroot

In reply of:

Quoted 9 lines

In commit a68899d49ec4c7f97dea0dcb9995e6a5d7b282c9 ("package/python3:
work around GCC bug 121567"), we introduced a work around for a gcc bug, by reducing to -O1 the optimization level on SuperH.

However, it turns out that this is not sufficient, as the build will only succeeded at -O0.

Fixes:

Quoted 7 lines

https://autobuild.buildroot.net/results/31f/31f34a983036b4135c12e5797b5c2258ab33e6c2/

Which is a config with BR2_OPTIMIZE_2=y, which means BR2_TOOLCHAIN_HAS_GCC_BUG_121567=y, and therefore -O1 is passed, but still the build fails. At -O0 the build doesn't fail.

Applied to 2025.11.x. Thanks

Quoted 24 lines
---
 package/python3/python3.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/python3/python3.mk +1 -1
index 0189a505b4..4e660ecee2 100644
@@ -192,7 +192,7 @@ endif
 PYTHON3_CFLAGS = $(TARGET_CFLAGS)
 
 ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_121567),y)
-PYTHON3_CFLAGS += -O1
+PYTHON3_CFLAGS += -O0
 endif
 
 PYTHON3_CONF_ENV += \
Signature · 6 lines
2.52.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot