From b665fd6cd41bafe8d1da073f4c3d0a7e6125f4fd Mon Sep 17 00:00:00 2001 From: zhang-liang-pengkun Date: Thu, 2 Nov 2023 15:35:57 +0800 Subject: [PATCH] Workaround a gcc bug using manual save/restore of r30 Signed-off-by: zhang-liang-pengkun --- ...-bug-using-manual-save-restore-of-r3.patch | 54 +++++++++++++++++++ python-greenlet.spec | 6 ++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 0002-Workaround-a-gcc-bug-using-manual-save-restore-of-r3.patch diff --git a/0002-Workaround-a-gcc-bug-using-manual-save-restore-of-r3.patch b/0002-Workaround-a-gcc-bug-using-manual-save-restore-of-r3.patch new file mode 100644 index 0000000..d7902f0 --- /dev/null +++ b/0002-Workaround-a-gcc-bug-using-manual-save-restore-of-r3.patch @@ -0,0 +1,54 @@ +From 86f72decefa955affbedf440a7f06ef5a5e04bc2 Mon Sep 17 00:00:00 2001 +From: Alexey Borzenkov +Date: Tue, 4 Sep 2018 23:30:27 +0300 +Subject: [PATCH] Workaround a gcc bug using manual save/restore of r30 (fixes + #136) + +--- + platform/switch_ppc64_linux.h | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/platform/switch_ppc64_linux.h b/platform/switch_ppc64_linux.h +index 53d127b..88e6847 100644 +--- a/platform/switch_ppc64_linux.h ++++ b/platform/switch_ppc64_linux.h +@@ -2,6 +2,8 @@ + * this is the internal transfer function. + * + * HISTORY ++ * 04-Sep-18 Alexey Borzenkov ++ * Workaround a gcc bug using manual save/restore of r30 + * 21-Mar-18 Tulio Magno Quites Machado Filho + * Added r30 to the list of saved registers in order to fully comply with + * both ppc64 ELFv1 ABI and the ppc64le ELFv2 ABI, that classify this +@@ -64,7 +66,7 @@ + + #define REGS_TO_SAVE "r14", "r15", "r16", "r17", "r18", "r19", "r20", \ + "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", \ +- "r30","r31", \ ++ "r31", \ + "fr14", "fr15", "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", \ + "fr22", "fr23", "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", \ + "fr30", "fr31", \ +@@ -77,8 +79,10 @@ slp_switch(void) + register int err; + register long *stackref, stsizediff; + void * toc; ++ void * r30; + __asm__ volatile ("" : : : REGS_TO_SAVE); + __asm__ volatile ("std 2, %0" : "=m" (toc)); ++ __asm__ volatile ("std 30, %0" : "=m" (r30)); + __asm__ ("mr %0, 1" : "=r" (stackref) : ); + { + SLP_SAVE_STATE(stackref, stsizediff); +@@ -91,6 +95,7 @@ slp_switch(void) + ); + SLP_RESTORE_STATE(); + } ++ __asm__ volatile ("ld 30, %0" : : "m" (r30)); + __asm__ volatile ("ld 2, %0" : : "m" (toc)); + __asm__ volatile ("" : : : REGS_TO_SAVE); + __asm__ volatile ("li %0, 0" : "=r" (err)); +-- +2.39.0.windows.2 + diff --git a/python-greenlet.spec b/python-greenlet.spec index ffc0785..45db1c5 100644 --- a/python-greenlet.spec +++ b/python-greenlet.spec @@ -1,11 +1,12 @@ Name: python-greenlet Version: 0.4.14 -Release: 5 +Release: 6 Summary: lightweight coroutines for in-process concurrent programming License: MIT URL: https://github.com/python-greenlet/greenlet Source0: https://github.com/python-greenlet/greenlet/archive/0.4.14.tar.gz Patch0001: 0001-Add-support-for-RISC-V.patch +Patch0002: 0002-Workaround-a-gcc-bug-using-manual-save-restore-of-r3.patch BuildRequires: python2-devel python2-setuptools python3-devel python3-setuptools BuildRequires: gcc-c++ @@ -84,6 +85,9 @@ that use python3-greenlet. %{_includedir}/python%{python3_version}*/greenlet/ %changelog +* Thu Nov 02 2023 zhangliangpengkun - 0.4.14-6 +- Workaround a gcc bug using manual save/restore of r30 + * Tue Oct 24 2023 zhangliangpengkun - 0.4.14-5 - Add support for RISC-V -- Gitee