bytecodealliance / bytecodealliance/wasmtime
Cranelift: Generate `.eh_frame` info for function epilogues
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
In https://github.com/bytecodealliance/wasmtime/issues/10421, I noticed that we do not emit unwind info for function epilogues:
> Here is the Wasm function `f(x) = x + 1` compiled by Wasmtime and Cranelift:
>
> ```asm
> 0000000000000000 :
> 0: 55 pushq %rbp
> 1: 48 89 e5 movq %rsp, %rbp
> 4: 8d 42 01 leal 0x1(%rdx), %eax
> 7: 48 89 ec movq %rbp, %rsp
> a: 5d popq %rbp
> b: c3 retq
> ```
>
> Here is the FDE that covers that function (lightly edited output of dwarfdump --eh-frame):
>
> ```asm
> FDE cie=00000000 pc=fffffffffffff000...fffffffffffff00c
> Format: DWARF32
> DW_CFA_advance_loc: 1
> DW_CFA_def_cfa_offset: +16
> DW_CFA_offset: RBP -16
> DW_CFA_advance_loc: 3
> DW_CFA_def_cfa_register: RBP
>
> 0xfffffffffffff000: CFA=RSP+8: RIP=[CFA-8]
> 0xfffffffffffff001: CFA=RSP+16: RBP=[CFA-16], RIP=[CFA-8]
> 0xfffffffffffff004: CFA=RBP+16: RBP=[CFA-16], RIP=[CFA-8]
> ```
>
> ...
>
> (Aside 1: we don't properly encode the CFA for the epilogue, but probably should for completeness. Will file a separate issue about this.)
Contributor guide
Assessment
This issue has not been assessed yet.