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

(cherry picked from commit 56c9302)
  • Loading branch information
gasche committed Feb 25, 2022
1 parent f36e5f2 commit 9a32caf
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 @@ -635,6 +635,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 @@ -826,7 +826,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 9a32caf

Please sign in to comment.