SFrame (“simple frame”) is a new format for unwinding the stack. It is used inside the Linux Kernel and has good support in the GNU toolchain. It is more fully described here:
I have a prototype implementation for both assembly and linking nearing completion at GitHub - Sterling-Augustine/llvm-project at sframe
It needs a fair amount of polish before it can be merged, but I would like to get started on that process. I expect the first part to be contributed would be adding a description in BinaryFormat, then the ability to read .sframe sections in objdump.
I’m told I should consult with upstream before starting to send patches.
Does anyone have questions or comments?
4 Likes
This looks like a good addition to LLVM.
Please submit the PR for dumping support first, so you can write regression tests for the assembler bits using it.
There’s a spec for the binary format, but I don’t really see a spec for the assembler support. Are there not any assembler directives because we expect the assembler to synthesize the section from DWARF-unwind directives? Is there some way to enable .sframe without enabling .eh_frame or .debug_frame? Is there some assembler directive for enabling .sframe, so we don’t need to pass a command-line flag to the assembler?
Will definitely do the objdump portions first.
Assembler support has very minimal additions syntactically. .sframe sections are synthesized from the same cfi directives that translate to .eh_frame and .debug_frame. There is a new assembler flag “–gsframes”, which generates sframes unconditionally, and a new possible parameter to the .cfi_sections
directive:
.cfi_sections [.eh_frame | .debug_frame | <target specific sections> | .sframe]
And from there it all happens without additional work.
Generating these is orthogonal to other unwind info sections. One could generate all three or four if one wanted. But they are all independent.
Hello everyone,
I am going to be working with @Sterling-Augustine on implementing this feature – mainly the dumping part. I’ve just sent the first PR defining the relevant constants and structures for the format. Please take a look.
regards,
Pavel
1 Like