Skip to content

Commit

Permalink
Merge pull request #11031 from fabbing/fp_exn_handler
Browse files Browse the repository at this point in the history
With frame-pointers, exception handlers should restore RBP
  • Loading branch information
gasche committed Feb 25, 2022
2 parents 849218e + a6369a2 commit 56c9302
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,11 @@ OCaml 4.14.0
Gentoo and Alpine).
(Alex Fan, review by Gabriel Scherer)

- #11031: Exception handlers restore the rbp register when using frame-pointers
on amd64.
(Fabrice Buoro, with help from Stephen Dolan, Tom Kelly and Mark Shinwell,
review by Xavier Leroy)

OCaml 4.13 maintenance branch
-----------------------------

Expand Down
5 changes: 4 additions & 1 deletion asmcomp/amd64/emit.mlp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,10 @@ let emit_instr env fallthrough i =
done;
emit_named_text_section env.f.fun_name
| Lentertrap ->
()
if fp then begin
let delta = frame_size env - 16 (* retaddr + rbp *) in
I.lea (mem64 NONE delta RSP) rbp
end;
| Ladjust_trap_depth { delta_traps; } ->
(* each trap occupies 16 bytes on the stack *)
let delta = 16 * delta_traps in
Expand Down

0 comments on commit 56c9302

Please sign in to comment.