gh-149202: Fix frame pointer unwinding on ppc64le and armv7/clang (#1… · python/cpython@612140e · GitHub
Skip to content

Commit 612140e

Browse files
authored
gh-149202: Fix frame pointer unwinding on ppc64le and armv7/clang (#149409)
- ppc64's backchain format is also different from x86 - On 32-bit ARM, clang needs `-mno-thumb`, not `-marm` like GCC
1 parent 5fcab14 commit 612140e

4 files changed

Lines changed: 56 additions & 4 deletions

File tree

Doc/using/configure.rst

Lines changed: 2 additions & 3 deletions

Modules/_testinternalcapi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ static const uintptr_t min_frame_pointer_addr = 0x1000;
9292
# define FRAME_POINTER_NEXT_OFFSET 0
9393
# define FRAME_POINTER_RETURN_OFFSET \
9494
(S390X_FRAME_RETURN_ADDRESS_OFFSET / (Py_ssize_t)sizeof(uintptr_t))
95+
#elif defined(__powerpc64__) || defined(__ppc64__)
96+
// ppc64le puts the return address at fp[2]; it saves the Condition Register
97+
// in fp[1]. See:
98+
// https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#STACK
99+
# define FRAME_POINTER_NEXT_OFFSET 0
100+
# define FRAME_POINTER_RETURN_OFFSET 2
95101
#else
96102
# define FRAME_POINTER_NEXT_OFFSET 0
97103
# define FRAME_POINTER_RETURN_OFFSET 1

configure

Lines changed: 44 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 4 additions & 0 deletions

0 commit comments

Comments
 (0)