Proposal
"backchain" is an LLVM target feature for s390x that adjust codegen in a way that stack walking (for the purpose of printing a backtrace) becomes easier or even possible. In that sense it is similar to frame pointers on other targets, though the implementation is different. See rust-lang/rust#158014 for more context.
In rust-lang/rust#158612, the lang team objected to exposing the "backchain" LLVM target feature as a Rust target feature, since "It specifically isn't a target feature; it's just a codegen option, like enabling frame pointers". And indeed this does not reflect a target CPU capability, making it unlike most of our target features. (But it is worth mentioning that we have -Ctarget-feature=+crt-static, which is not even a codegen option, it's more of a linker option. So if we are serious about target features being used only for CPU capabilities, we should consider deprecating -Ctarget-feature=+crt-static in the long term. This MCP does not propose anything like that, I just mentioned it for context.)
So, this is the proposal to add such a codegen option. In rust-lang/rust#158612, two options have been considered to do that:
- add a general
-Cstack-walking-support that controls stack walking related options across targets. Values include:
yes, meaning "just make stack walking better, if possible, or ignore if that doesn't work"
frame-pointers, which is equivalent to -Cforce-frame-pointers=yes. TODO: does it error or is it ignored if frame pointers are not useful for stack walking on the current target?)
backchain, which enables the corresponding target feature on s390x. TODO: does it error on other targets?
- add a new
-Cbackchain specifically for s390x
I have a mild preference for the former so that's what this MCP proposes.
Mentors or Reviewers
I won't do the implementation but I hope @fneddy can look into that
Process
The main points of the Major Change Process are as follows:
You can read more about Major Change Proposals on forge.
Proposal
"backchain" is an LLVM target feature for s390x that adjust codegen in a way that stack walking (for the purpose of printing a backtrace) becomes easier or even possible. In that sense it is similar to frame pointers on other targets, though the implementation is different. See rust-lang/rust#158014 for more context.
In rust-lang/rust#158612, the lang team objected to exposing the "backchain" LLVM target feature as a Rust target feature, since "It specifically isn't a target feature; it's just a codegen option, like enabling frame pointers". And indeed this does not reflect a target CPU capability, making it unlike most of our target features. (But it is worth mentioning that we have
-Ctarget-feature=+crt-static, which is not even a codegen option, it's more of a linker option. So if we are serious about target features being used only for CPU capabilities, we should consider deprecating-Ctarget-feature=+crt-staticin the long term. This MCP does not propose anything like that, I just mentioned it for context.)So, this is the proposal to add such a codegen option. In rust-lang/rust#158612, two options have been considered to do that:
-Cstack-walking-supportthat controls stack walking related options across targets. Values include:yes, meaning "just make stack walking better, if possible, or ignore if that doesn't work"frame-pointers, which is equivalent to-Cforce-frame-pointers=yes. TODO: does it error or is it ignored if frame pointers are not useful for stack walking on the current target?)backchain, which enables the corresponding target feature on s390x. TODO: does it error on other targets?-Cbackchainspecifically for s390xI have a mild preference for the former so that's what this MCP proposes.
Mentors or Reviewers
I won't do the implementation but I hope @fneddy can look into that
Process
The main points of the Major Change Process are as follows:
@rustbot secondor kickoff a team FCP with@rfcbot fcp $RESOLUTION.You can read more about Major Change Proposals on forge.