diff options
author | Khem Raj <raj.khem@gmail.com> | 2025-04-06 21:03:40 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2025-04-06 21:15:01 -0700 |
commit | 63eb38b4301650b57bb9f613797aabe700ce1a72 (patch) | |
tree | 5859ea21422bf444022ea6198b947f9a964d15cb | |
parent | 62012af133614e2c96af77e1e34448956c8f3dac (diff) | |
download | meta-openembedded-63eb38b4301650b57bb9f613797aabe700ce1a72.tar.gz |
python3-greenlet: Fix build on RISCV32
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-python/recipes-devtools/python/python3-greenlet/0001-slp_switch-Implement-for-RISCV32.patch | 48 | ||||
-rw-r--r-- | meta-python/recipes-devtools/python/python3-greenlet_3.1.1.bb | 2 |
2 files changed, 50 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-greenlet/0001-slp_switch-Implement-for-RISCV32.patch b/meta-python/recipes-devtools/python/python3-greenlet/0001-slp_switch-Implement-for-RISCV32.patch new file mode 100644 index 0000000000..83877d3860 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-greenlet/0001-slp_switch-Implement-for-RISCV32.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From 524fd7244cfec4ec6760e52001c9a41d1913066e Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 6 Apr 2025 20:54:08 -0700 | ||
4 | Subject: [PATCH] slp_switch: Implement for RISCV32 | ||
5 | |||
6 | Changed data types from long to int for fp variable | ||
7 | stackref pointer and stsizediff variable | ||
8 | |||
9 | Changed the load instruction from ld (64-bit load) to lw (32-bit load) | ||
10 | |||
11 | Upstream-Status: Submitted [https://github.com/python-greenlet/greenlet/pull/439] | ||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | src/greenlet/platform/switch_riscv_unix.h | 11 ++++++++++- | ||
15 | 1 file changed, 10 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/src/greenlet/platform/switch_riscv_unix.h b/src/greenlet/platform/switch_riscv_unix.h | ||
18 | index e74f37a..32ca78c 100644 | ||
19 | --- a/src/greenlet/platform/switch_riscv_unix.h | ||
20 | +++ b/src/greenlet/platform/switch_riscv_unix.h | ||
21 | @@ -11,9 +11,14 @@ | ||
22 | static int | ||
23 | slp_switch(void) | ||
24 | { | ||
25 | - long fp; | ||
26 | int ret; | ||
27 | +#if __riscv_xlen == 32 | ||
28 | + long fp; | ||
29 | long *stackref, stsizediff; | ||
30 | +#else | ||
31 | + int fp; | ||
32 | + int *stackref, stsizediff; | ||
33 | +#endif | ||
34 | __asm__ volatile ("" : : : REGS_TO_SAVE); | ||
35 | __asm__ volatile ("mv %0, fp" : "=r" (fp) : ); | ||
36 | __asm__ volatile ("mv %0, sp" : "=r" (stackref) : ); | ||
37 | @@ -28,7 +33,11 @@ slp_switch(void) | ||
38 | SLP_RESTORE_STATE(); | ||
39 | } | ||
40 | __asm__ volatile ("" : : : REGS_TO_SAVE); | ||
41 | +#if __riscv_xlen == 32 | ||
42 | + __asm__ volatile ("lw fp, %0" : : "m" (fp)); | ||
43 | +#else | ||
44 | __asm__ volatile ("ld fp, %0" : : "m" (fp)); | ||
45 | +#endif | ||
46 | __asm__ volatile ("mv %0, zero" : "=r" (ret) : ); | ||
47 | return ret; | ||
48 | } | ||
diff --git a/meta-python/recipes-devtools/python/python3-greenlet_3.1.1.bb b/meta-python/recipes-devtools/python/python3-greenlet_3.1.1.bb index c7a38b9a12..b45edac12d 100644 --- a/meta-python/recipes-devtools/python/python3-greenlet_3.1.1.bb +++ b/meta-python/recipes-devtools/python/python3-greenlet_3.1.1.bb | |||
@@ -8,4 +8,6 @@ SRC_URI[sha256sum] = "4ce3ac6cdb6adf7946475d7ef31777c26d94bccc377e070a7986bd2d5c | |||
8 | 8 | ||
9 | inherit pypi python_setuptools_build_meta | 9 | inherit pypi python_setuptools_build_meta |
10 | 10 | ||
11 | SRC_URI += "file://0001-slp_switch-Implement-for-RISCV32.patch" | ||
12 | |||
11 | BBCLASSEXTEND = "native nativesdk" | 13 | BBCLASSEXTEND = "native nativesdk" |