]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-120400 :Support Linux perf profile to see Python calls on RISC-V architectu...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 14 Jun 2024 15:03:24 +0000 (17:03 +0200)
committerGitHub <noreply@github.com>
Fri, 14 Jun 2024 15:03:24 +0000 (17:03 +0200)
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 <yangwang@iscas.ac.cn>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Misc/NEWS.d/next/Core and Builtins/2024-06-05-06-26-04.gh-issue- [new file with mode: 0644]
Misc/NEWS.d/next/Core and Builtins/2024-06-12-12-29-45.gh-issue-120400.lZYHVS.rst [new file with mode: 0644]
Python/asm_trampoline.S
configure
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 (file)
index 0000000..29f06d4
--- /dev/null
@@ -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 (file)
index 0000000..8c86d47
--- /dev/null
@@ -0,0 +1 @@
+Support Linux perf profiler to see Python calls on RISC-V architecture.
index 460707717df0032b2f2bdaa7c50a6cb464caa591..0a3265dfeee20445da5281b4e10007fb47ab0bff 100644 (file)
@@ -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:
index 97bb37d51facab00e1730c0503c4e36d536c7c36..b7e2e8e159253a184b7a461652baab0dd3578387 100755 (executable)
--- 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
  ;;
index c7f3703bf3d99dfacfeb39552bd06038e895fb62..4e4a7097666ef3cc2e4b1191abebfcb812814bfa 100644 (file)
@@ -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])