Skip to content

Invalid Instruction - aarch64 with armv8-a (Raspberry Pi 4) #1095

Closed
@adasek

Description

@adasek

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

set(MI_OPT_ARCH_FLAGS "-march=armv8.1-a") # fast atomics
from 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions