[Buildroot] [git commit branch/2025.05.x] package/python3: work around GCC bug 121567
Thomas Perale
thomas.perale at mind.be
Fri Sep 5 15:25:51 UTC 2025
commit: https://git.buildroot.net/buildroot/commit/?id=d157e3e65063cf86c078de1d051a2c636be3812e
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2025.05.x
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/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Signed-off-by: Julien Olivain <ju.o at free.fr>
(cherry picked from commit a68899d49ec4c7f97dea0dcb9995e6a5d7b282c9)
Signed-off-by: Thomas Perale <thomas.perale at mind.be>
---
package/python3/python3.mk | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index 337e1401de..082dd69bf1 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -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
More information about the buildroot
mailing list