https://github.com/python/cpython/commit/b3cfd36ba4f17c19d587427b90ca9378ad009978
commit: b3cfd36ba4f17c19d587427b90ca9378ad009978
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-05-07T11:47:08+02:00
summary:

gh-149202: Don't use -fno-omit-frame-pointer on ppc64le (#149485)

The power ABI specification requires that compilers maintain a back
chain by default, so unwinding already works without a dedicated
frame pointer. Don't use -fno-omit-frame-pointer on ppc64le.

files:
M Doc/using/configure.rst
M Lib/test/test_frame_pointer_unwind.py
M configure
M configure.ac

diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst
index a0e46ff4e375b6..77771bb70e1a30 100644
--- a/Doc/using/configure.rst
+++ b/Doc/using/configure.rst
@@ -792,6 +792,8 @@ also be used to improve performance.
    - ``-marm`` and/or ``-mno-thumb`` is added on 32-bit ARM when supported,
    - on s390x platforms, when supported, ``-mbackchain`` is added *instead*.
      of the above frame pointer flags.
+   - on ppc64le platforms, no compiler flags is needed since the power ABI
+     requires that compilers maintain a back chain by default.
 
    Frame pointers enable profilers, debuggers, and system tracing tools
    (``perf``, ``eBPF``, ``dtrace``, ``gdb``) to walk the C call stack
diff --git a/Lib/test/test_frame_pointer_unwind.py 
b/Lib/test/test_frame_pointer_unwind.py
index 5cd94e5b27f394..faa012c9c00d8f 100644
--- a/Lib/test/test_frame_pointer_unwind.py
+++ b/Lib/test/test_frame_pointer_unwind.py
@@ -56,6 +56,12 @@ def _frame_pointers_expected(machine):
             if sys.maxsize < 2**32:
                 return None
             return True
+        if machine == "ppc64le":
+            # The power ABI specification requires that compilers maintain a
+            # back chain by default, so unwinding already works without a
+            # dedicated frame pointer.
+            # https://openpowerfoundation.org/specifications/64bitelfabi/
+            return True
         if machine == "x86_64":
             final_opt = ""
             for opt in cflags.split():
diff --git a/configure b/configure
index 3377bf7516ebd2..cff7dfbfba8b9a 100755
--- a/configure
+++ b/configure
@@ -10435,6 +10435,14 @@ fi
        ;; #(
   *) :
      ;;
+esac
+      case $host_cpu in #(
+  powerpc64le) :
+
+        frame_pointer_cflags=""
+       ;; #(
+  *) :
+     ;;
 esac
       case $host_cpu in #(
   s390*) :
diff --git a/configure.ac b/configure.ac
index fc2db4d5e8aebb..ac3269ab765c0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2557,6 +2557,9 @@ AS_VAR_IF([ac_cv_gcc_compat], [yes], [
           frame_pointer_cflags="$frame_pointer_cflags -mno-thumb"
         ], [], [-Werror])
       ])
+      AS_CASE([$host_cpu], [powerpc64le], [
+        frame_pointer_cflags=""
+      ])
       AS_CASE([$host_cpu], [s390*], [
         AX_CHECK_COMPILE_FLAG([-mbackchain], [
           dnl Do not use no-omit-frame-pointer; see gh-149362

_______________________________________________
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