ocaml-solo5
ocaml-solo5 copied to clipboard
`memcpy` does not work on RPi4
I think the issue is really complex but I took the nolibc
implementation here for [gilbraltar
][] and I was stuck at one point where memcpy
seems to fail. Indeed, with my experiment, a simpler memcpy
such as:
void *memcpy(void *v_dst, const void *v_src, size_t len)
{
char *dst = v_dst;
const char *src = v_src;
for (; len; len--) *dst++ = *src++;
return dst;
}
seems to work when the current one seems to do something illegal for the Raspberry Pi 4. I don't really know where is the error (if it's about Aarch64 or the layout of my ELF or just because the code is may be too complex for what it should do). But I'm sure that something is wrong only on Raspberry Pi 4.
Due to the fact that we want to support the cross-compilation and specially about the Aarch64 architecture, I wrote this issue to keep in our mind that may be something is wrong about the current implementation - but again, it's not clear when I can not dump why the Raspberry Pi 4 wants to do.
Note that the current nolibc
works with qemu
- so you can figure out how painful it was to debug.
In my experience, this may be an alignment issue. Though I have not looked at the implementation, nor at the aarch64 alignment requirements. I only stumbled upon that in mirage-crypto earlier this year (mirage/mirage-crypto#79 mirage/mirage-crypto#81 mirage/mirage-crypto#143).
I confirm that the initial issue was about an alignment on aarch64
- it's just incredibly hard to track down on Raspberry Pi.