https://github.com/python/cpython/commit/d73f856840369a20038c606cc7f979cc2c0d6505
commit: d73f856840369a20038c606cc7f979cc2c0d6505
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: Yhg1s <[email protected]>
date: 2024-06-14T17:03:24+02:00
summary:

[3.13] gh-120400 :Support Linux perf profile to see Python calls on RISC-V 
architecture (GH-120089) (#120413)

gh-120400 :Support Linux perf profile to see Python calls on RISC-V 
architecture (GH-120089)
(cherry picked from commit 4b1e85bafc5bcb8cb70bb17164e07aebf7ad7e8e)

Co-authored-by: ixgbe00 <[email protected]>
Co-authored-by: Pablo Galindo Salgado <[email protected]>

files:
A Misc/NEWS.d/next/Core and Builtins/2024-06-05-06-26-04.gh-issue-
A Misc/NEWS.d/next/Core and 
Builtins/2024-06-12-12-29-45.gh-issue-120400.lZYHVS.rst
M Python/asm_trampoline.S
M configure
M configure.ac

diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-06-05-06-26-04.gh-issue- 
b/Misc/NEWS.d/next/Core and Builtins/2024-06-05-06-26-04.gh-issue-
new file mode 100644
index 00000000000000..29f06d43c3598c
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2024-06-05-06-26-04.gh-issue-  
@@ -0,0 +1 @@
+Support Linux perf profiler to see Python calls on RISC-V architecture
diff --git a/Misc/NEWS.d/next/Core and 
Builtins/2024-06-12-12-29-45.gh-issue-120400.lZYHVS.rst b/Misc/NEWS.d/next/Core 
and Builtins/2024-06-12-12-29-45.gh-issue-120400.lZYHVS.rst
new file mode 100644
index 00000000000000..8c86d4750e39a8
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and 
Builtins/2024-06-12-12-29-45.gh-issue-120400.lZYHVS.rst 
@@ -0,0 +1 @@
+Support Linux perf profiler to see Python calls on RISC-V architecture.
diff --git a/Python/asm_trampoline.S b/Python/asm_trampoline.S
index 460707717df003..0a3265dfeee204 100644
--- a/Python/asm_trampoline.S
+++ b/Python/asm_trampoline.S
@@ -22,6 +22,14 @@ _Py_trampoline_func_start:
     blr     x3
     ldp     x29, x30, [sp], 16
     ret
+#endif
+#ifdef __riscv
+    addi    sp,sp,-16
+    sd      ra,8(sp)
+    jalr    a3
+    ld      ra,8(sp)
+    addi    sp,sp,16
+    jr      ra
 #endif
     .globl     _Py_trampoline_func_end
 _Py_trampoline_func_end:
diff --git a/configure b/configure
index 97bb37d51facab..b7e2e8e159253a 100755
--- a/configure
+++ b/configure
@@ -13133,6 +13133,8 @@ case $PLATFORM_TRIPLET in #(
     perf_trampoline=yes ;; #(
   aarch64-linux-gnu) :
     perf_trampoline=yes ;; #(
+  riscv64-linux-gnu) :
+    perf_trampoline=yes ;; #(
   *) :
     perf_trampoline=no
  ;;
diff --git a/configure.ac b/configure.ac
index c7f3703bf3d99d..4e4a7097666ef3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3641,6 +3641,7 @@ AC_MSG_CHECKING([perf trampoline])
 AS_CASE([$PLATFORM_TRIPLET],
   [x86_64-linux-gnu], [perf_trampoline=yes],
   [aarch64-linux-gnu], [perf_trampoline=yes],
+  [riscv64-linux-gnu], [perf_trampoline=yes],
   [perf_trampoline=no]
 )
 AC_MSG_RESULT([$perf_trampoline])

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to