Workaround a gcc bug using manual save/restore of r30

Signed-off-by: zhang-liang-pengkun <zhangliangpengkun@xfusion.com>
This commit is contained in:
zhang-liang-pengkun 2023-11-02 15:50:38 +08:00
parent 02ba863503
commit 4ec3df5d6f
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From 86f72decefa955affbedf440a7f06ef5a5e04bc2 Mon Sep 17 00:00:00 2001
From: Alexey Borzenkov <snaury@gmail.com>
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 <snaury@gmail.com>
+ * Workaround a gcc bug using manual save/restore of r30
* 21-Mar-18 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* 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

View File

@ -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<zhangliangpengkun@xfusion.com> - 0.4.14-6
- Workaround a gcc bug using manual save/restore of r30
* Tue Oct 24 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.4.14-5
- Add support for RISC-V