Le 19/06/2024 à 12:45, John Paul Adrian Glaubitz a écrit :
To reproduce the problem quickly:
- unpack ocaml 5.2.0 source package
- ./configure --enable-imprecise-c99-float-ops
- make coldstart
Is there some subtlety with thread local variables on m68k?
Can you please try reproduce the issue on the porterbox mitchy.debian.net first
to
make sure it's not related to the QEMU build environment on the buildds?
I can reproduce the issue on mitchy.debian.net.
OK, then it's actually a bug.
One important thing to know is that the natural alignment on m68k is actually
16 bits
and not 32 bits which causes quite some issues with various upstream projects.
We're currently planning on switching the alignment on m68k to 32 bits and
chances are
that this could this issue as well.
Can you maybe try passing "-malign-int" to CFLAGS/CXXFLAGS when building OCaml
on m68k
to verify this hypothesis? Please note that this also breaks the SysV ABI, so
it's not
possible to easily do this on a per-package basis.
I observe the same behaviour with "-malign-int": the address of
caml_state (a thread local variable) changes unexpectedly (goes from
0x402e5fac to 0x402e7454) after the following goto:
https://salsa.debian.org/ocaml-team/ocaml/-/blob/debian/experimental/runtime/interp.c?ref_type=heads#L295
which leads to:
https://salsa.debian.org/ocaml-team/ocaml/-/blob/debian/experimental/runtime/interp.c?ref_type=heads#L819
...confirmed by adding:
fprintf(stderr, "&caml_state = %p\n", &caml_state);
before the goto and after the "Instruct(BRANCH):".
Cheers,
--
Stéphane