{{ message }}
gh-152240: Fix test_c_stack_unwind on Linux LoongArch builds#152241
Open
yzewei wants to merge 1 commit into
Open
gh-152240: Fix test_c_stack_unwind on Linux LoongArch builds#152241yzewei wants to merge 1 commit into
yzewei wants to merge 1 commit into
Conversation
Author
vstinner
approved these changes
Jun 26, 2026
vstinner
left a comment
Member
There was a problem hiding this comment.
The change LGTM, even if I don't know LoongArch architecture.
The -funwind-tables compiler flag is only needed by GnuBacktraceUnwindTests of test_c_stack_unwind? If yes, is it really worth it to add .eh_frame unwind tables just for a test?
@diegorusso @pablogsal: What do you think about the -funwind-tables flag?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fix
test_c_stack_unwindon Linux LoongArch builds.This change teaches
_testinternalcapi's manual frame-pointer unwinder aboutthe LoongArch frame layout. On LoongArch, the frame pointer is the caller's
stack pointer; the previous frame pointer is at
fp[-2], and the returnaddress is at
fp[-1].It also adds
-funwind-tablesfor Linux LoongArch clang builds. clang/LoongArchemits
.debug_framebut not runtime.eh_frameunwind tables by default, soglibc
backtrace()cannot unwind through CPython frames unless unwind tablesare requested.
Validated on Linux LoongArch64:
GCC build:
../cpython/configure --with-pydebug CC=gcc make -j8 PYTHON_JIT=0 ./python -m test -v test_c_stack_unwindclang build with clang 20.1.8:
../cpython/configure --with-pydebug CC=clang make -j8 PYTHON_JIT=0 ./python -m test -v test_c_stack_unwindAlso verified that
-funwind-tablesmakes CPython C objects contain.eh_frame, and the GNU backtrace test passes.