toolchain/Config.in: add BR2_TOOLCHAIN_HAS_GCC_BUG_121567
PATCH 1/2 toolchain/Config.in: add BR2_TOOLCHAIN_HAS_GCC_BUG_121567
This will be needed to work around a GCC bug affecting python3. The bug is reported at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121567.
This bug affects GCC at least since 6.x, but we couldn't test earlier versions, so we simply assume all GCC versions are affected. Even GCC 15.x is still affected, as reported to upstream GCC.
--- toolchain/Config.in | 10 ++++++++++ 1 file changed, 10 insertions(+)
toolchain/Config.in +10 -0
@@ -243,6 +243,16 @@ 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.50.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/python3: work around GCC bug 121567
When Python 3 is built with -O2 or -O3 on SuperH, the build fails with:
Objects/obmalloc.c:503:1: error: unable to find a register to spill in class ‘R0_REGS’
503 | }
| ^
Objects/obmalloc.c:503:1: error: this is the insn:
(insn 18 243 23 2 (parallel [
(set (subreg:SI (reg:QI 176) 0)
(unspec_volatile:SI [
(mem/v:QI (reg:SI 4 r4 [175]) [-1 S1 A32])
(reg:QI 7 r7 [178])
(reg:QI 6 r6 [180])
] UNSPECV_CMPXCHG_1))
(set (mem/v:QI (reg:SI 4 r4 [175]) [-1 S1 A32])
(unspec_volatile:QI [
(const_int 0 [0])
] UNSPECV_CMPXCHG_2))
(set (reg:SI 147 t)
(unspec_volatile:SI [
(const_int 0 [0])
] UNSPECV_CMPXCHG_3))
(clobber (scratch:SI))
(clobber (reg:SI 0 r0))
(clobber (reg:SI 1 r1))
]) "./Include/cpython/pyatomic_gcc.h":105:10 407 {atomic_compare_and_swapqi_soft_gusa}
(expr_list:REG_DEAD (reg:QI 6 r6 [180])
(expr_list:REG_DEAD (reg:QI 7 r7 [178])
(expr_list:REG_UNUSED (reg:QI 176)
(expr_list:REG_UNUSED (reg:SI 1 r1)
(expr_list:REG_UNUSED (reg:SI 0 r0)
(nil)))))))Objects/obmalloc.c:503: confused by earlier errors, bailing out
THe bug has been reported upstream, but until it gets fixed, let's work it around by using -O1 instead. Note that BR2_TOOLCHAIN_HAS_GCC_BUG_121567 is only set when -O2 or -O3 is configured, so there's no need to check again.
Fixes:
https://autobuild.buildroot.net/results/cac123ee9f3a6df6263b69dce3ac0d535518ec3f/
--- package/python3/python3.mk | 9 +++++++++ 1 file changed, 9 insertions(+)
package/python3/python3.mk +9 -0
@@ -192,6 +192,15 @@ else PYTHON3_CONF_ENV += ac_cv_big_endian_double=yes endif +PYTHON3_CFLAGS = $(TARGET_CFLAGS) + +ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_121567),y) +PYTHON3_CFLAGS += -O1 +endif + +PYTHON3_CONF_ENV += \ + CFLAGS="$(PYTHON3_CFLAGS)" + ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y) PYTHON3_DEPENDENCIES += gettext endif
Signature · 6 lines
2.50.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 9 lines · Thomas Petazzoni via buildroot
This will be needed to work around a GCC bug affecting python3. The bug is reported at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121567.This bug affects GCC at least since 6.x, but we couldn't test earlier versions, so we simply assume all GCC versions are affected. Even GCC 15.x is still affected, as reported to upstream GCC.
Signed-off-by Thomas Petazzoni <[email protected]>
Series applied to master, thank.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot