Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix C stack unwinding tests on Linux LoongArch builds. The manual frame
pointer unwinder now recognizes the LoongArch frame layout, and clang builds
now request runtime unwind tables.
6 changes: 6 additions & 0 deletions Modules/_testinternalcapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ static const uintptr_t min_frame_pointer_addr = 0x1000;
// https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#STACK
# define FRAME_POINTER_NEXT_OFFSET 0
# define FRAME_POINTER_RETURN_OFFSET 2
#elif defined(__loongarch__)
// On LoongArch, the frame pointer is the caller's stack pointer.
// The saved frame pointer is stored at fp[-2], and the return
// address is stored at fp[-1].
# define FRAME_POINTER_NEXT_OFFSET -2
# define FRAME_POINTER_RETURN_OFFSET -1
#else
# define FRAME_POINTER_NEXT_OFFSET 0
# define FRAME_POINTER_RETURN_OFFSET 1
Expand Down
56 changes: 56 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2631,6 +2631,16 @@ AS_VAR_IF([ac_cv_gcc_compat], [yes], [

CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"

AS_IF([test "$MACHDEP" = linux && test "$ac_cv_cc_name" = clang], [
AS_CASE([$host_cpu], [loongarch*], [
dnl clang/LoongArch emits only .debug_frame by default, which is not
dnl available to runtime unwinders such as backtrace().
AX_CHECK_COMPILE_FLAG([-funwind-tables], [
CFLAGS_NODIST="$CFLAGS_NODIST -funwind-tables"
], [], [-Werror])
])
])

PY_CHECK_CC_WARNING([enable], [extra], [if we can add -Wextra])
AS_VAR_IF([ac_cv_enable_extra_warning], [yes],
[CFLAGS_NODIST="$CFLAGS_NODIST -Wextra"])
Expand Down
Loading