Skip to content

[Backtracing][IRGen] Add a semantic attribute to force frame pointer. #66371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

al45tair
Copy link
Contributor

@al45tair al45tair commented Jun 6, 2023

The Swift backtracer's frame pointer unwinder cannot work on Linux without this change, because the compiler omits the frame pointer from the function in libSwift_Backtracing that actually captures the stack.

rdar://110260855

The Swift backtracer's frame pointer unwinder cannot work on Linux
without this change, because the compiler omits the frame pointer from
the function in libSwift_Backtracing that actually captures the stack.

rdar://110260855
@al45tair al45tair added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.9 labels Jun 6, 2023
@al45tair al45tair requested a review from a team as a code owner June 6, 2023 16:54
@al45tair
Copy link
Contributor Author

al45tair commented Jun 6, 2023

Explanation: On Linux, we need to force the compiler to use the frame pointer in one of the functions in the _Backtracing library, otherwise it omits the frame pointer and renders the frame pointer unwinder totally useless (because it always has to go through that frame to get to user code). The frame pointer unwinder is desirable because it's fast (compared to the EH unwinder, which I haven't merged into the Linux code yet).
Risk: Low. Only affects functions that use the new attribute, which in practice means the backtracer on Linux.
Original PR: #66333
Reviewed by: @aschwaighofer
Resolves: rdar://110260855
Tests: The Linux unwinding tests exercise this code a lot and they don't work without it.

@al45tair
Copy link
Contributor Author

al45tair commented Jun 6, 2023

@swift-ci Please test

@al45tair al45tair merged commit 2fb7c36 into swiftlang:release/5.9 Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants