ocaml icon indicating copy to clipboard operation
ocaml copied to clipboard

POWER back-end: fix issue with call to `caml_call_realloc_stack` from a DLL

Open xavierleroy opened this issue 1 year ago • 1 comments

Currently, the required stack frame size is passed to caml_call_realloc_stack in register 12. However, this register is destroyed by the shims inserted by the dynamic loader. Consequently, the required size can be corrupted if the caller of caml_call_realloc_stack is in a DLL. This seems to be the root cause for https://github.com/LPCIC/coq-elpi/issues/678.

Trivial fix in this PR: use a different, non-temporary register to pass the required size.

xavierleroy avatar Aug 29 '24 10:08 xavierleroy

With this PR, https://github.com/LPCIC/coq-elpi/issues/678 builds fine.

xavierleroy avatar Aug 29 '24 10:08 xavierleroy

I made this PR against 5.2 to make testing on coq-elpi easier. Should we merge on 5.2 and cherry-pick on trunk, or should I rebase this PR?

xavierleroy avatar Aug 29 '24 11:08 xavierleroy

Thanks you so much @xavierleroy !

gares avatar Aug 29 '24 12:08 gares

For regularity's sake, I believe it is better to retarget the PR to trunk, and then cherry-pick it to 5.2 and 5.3.

Octachron avatar Aug 29 '24 12:08 Octachron

Rebased on trunk... done! CI precheck... done! [probably unrelated random failures on tests/lib-runtime-events/test_dropped_events.ml on POWER, to be investigated] This looks ready for merging.

xavierleroy avatar Aug 29 '24 15:08 xavierleroy

(CI kick)

dra27 avatar Aug 29 '24 16:08 dra27

Merged and cherry-picked to 5.2 7af0046399 and to 5.3 85c7730173.

xavierleroy avatar Aug 30 '24 12:08 xavierleroy