-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Invalid Instruction - aarch64 with armv8-a (Raspberry Pi 4) #1095
Description
Hi,
I'm running typescript linting a Raspberry Pi 4 system and recently some Rust compiled libraries were added to my stack and it started to fail with:
Illegal instruction (exit code 132)
I reported the issue to the packages unrs-resolver and oxc-project but after a deeper research I believe the problem is in mimalloc.
When compiling mimaloc on my system, -march=armv8.1-a is used and it causes mi_atomic_add_acq_rel aka atomic_fetch_add_explicit call to be compiled as ldaddal instruction that's unsupported by my system - Rpi4 is apparently armv8-a.
I've checked the issue persist on another Raspberry Pi 4 hardware with a clean Raspbian 64bit installation. Similar failure on aarch64 AWS EC2 instance was also reported
A most straightforward fix would be to change
Line 442 in d2e259c
| set(MI_OPT_ARCH_FLAGS "-march=armv8.1-a") # fast atomics |
armv8.1-a to armv8-a. Using a minimal mimalloc usage example I verified that it fixes my problem, but it will mean a performance drop in aarch64 systems supporting armv8.1-a, so I'm seeking for some more precise way.
Let me know if you need any more information or testing.