Repository navigation
Description
Description
The Swift 6.4.2 Static Linux SDK (swift-6.4.2-RELEASE_static-linux-0.1.0) produces AArch64 static executables that crash with SIGILL (Illegal instruction) on ARMv8.0 CPUs, such as the Cortex-A53 used by some OpenWrt devices.
Even a minimal print("Hello World") program fails to execute.
The same executable runs successfully under QEMU with -cpu max, but crashes with -cpu cortex-a53.
Specifying -target-cpu cortex-a53 during compilation does not resolve the issue.
GDB confirms that the crash occurs in mimalloc, which is statically linked into the executable through the SDK's libc.a.
The failing instruction is ldaddal, an ARMv8.1-A LSE atomic instruction that is not supported by ARMv8.0 CPUs.
This appears to be the same underlying issue previously reported in swiftlang/swift-docker#604, originally affecting the Swift 6.4.0 Static Linux SDK. I can confirm that the issue is also reproducible with the 6.4.2 release.
Reproduction
Create a minimal Swift program:
print("Hello World")Save it as hello.swift.
Using the Swift 6.4.2 Static Linux SDK, compile it for AArch64 musl with Cortex-A53 as the target CPU.
In my installation, the SDK sysroot is located under the installed artifact bundle's musl-1.2.5.sdk/aarch64 directory.
SDK=$(find "$HOME/.swiftpm/swift-sdks" \
-type d \
-path '*/musl-1.2.5.sdk/aarch64' \
-print -quit)
RES="$SDK/usr/lib/swift_static"
swiftc hello.swift -O \
-target aarch64-swift-linux-musl \
-target-cpu cortex-a53 \
-sdk "$SDK" \
-sysroot "$SDK" \
-resource-dir "$RES" \
-static-executable \
-o helloTest the resulting executable using QEMU:
$ qemu-aarch64 -cpu cortex-a53 ./hello
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction
$ qemu-aarch64 -cpu max ./hello
Hello WorldThe executable also crashes with Illegal instruction when run directly on an OpenWrt device using a Cortex-A53 CPU.
I investigated the crash using QEMU's GDB remote debugging support:
qemu-aarch64 -cpu cortex-a53 -g 1234 ./helloIn another terminal:
(gdb) target remote :1234
(gdb) continue
Program received signal SIGILL, Illegal instruction.
0x000000000076d75c in mi_out_buf_flush (...)
at /home/build-user/source/mimalloc/src/options.c:352Inspecting the instruction at the program counter:
(gdb) x/i $pc
=> 0x76d75c <_mi_options_init+24>: ldaddal x8, x8, [x9]This confirms that the executable attempts to execute an ARMv8.1-A LSE instruction on an ARMv8.0 CPU.
Expected behavior
AArch64 static executables built with the Swift Static Linux SDK should run on ARMv8.0 CPUs unless a newer architecture is explicitly required.
Specifying -target-cpu cortex-a53 should not result in an executable that unconditionally executes ARMv8.1-A instructions from precompiled SDK libraries.
The SDK's bundled mimalloc should either use an ARMv8.0-compatible baseline or provide runtime CPU feature detection before using LSE atomics.
Environment
Build environment:
OS: Linux (Asahi Linux kernel)
Architecture: AArch64
$ uname -a
Linux test 7.3.3-asahi-1-cy8aer1 #121 SMP PREEMPT Sun Nov 8 14:45:48 CET 2026 aarch64 GNU/LinuxSwift:
$ swift --version
Swift version 6.4.2 (swift-6.4.2-RELEASE)
Target: aarch64-unknown-linux-gnuClang:
$ clang --version
clang version 21.0.0 (https://github.com/swiftlang/llvm-project.git fb5f84d903a3b4e7aea15cd5666598a46f56c833)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /root/.local/share/swiftly/toolchains/6.4.2/usr/binStatic Linux SDK: swift-6.4.2-RELEASE_static-linux-0.1.0
Target triple: aarch64-swift-linux-musl
Musl version: 1.2.5
Build configuration: -O -target-cpu cortex-a53 -static-executable
Target environment:
OS: OpenWrt
Architecture: AArch64
CPU: ARM Cortex-A53 (ARMv8.0-A)
$ uname -m
aarch64
$ cat /proc/cpuinfo
processor : 0
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 1
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4The target CPU does not support ARMv8.1-A LSE atomic instructions.
Debugging environment:
GDB: 16.3
QEMU: qemu-aarch64 (cortex-a53 and max CPU configurations)
Additional information
The underlying mimalloc configuration issue was previously investigated in:
That report identifies mimalloc's architecture-specific optimization setting as the cause. Mimalloc 2.2.x enables ARMv8.1-A optimizations by default on AArch64, introducing LSE instructions into the precompiled mimalloc.o included in the SDK's libc.a.
I was able to reproduce the issue and verify a working fix with the Swift 6.4.2 Static Linux SDK.
I rebuilt mimalloc 2.2.4 with the following options:
-DMI_LIBC_MUSL=ON
-DMI_NO_OPT_ARCH=ON
-DCMAKE_C_FLAGS="-march=armv8-a"
I then replaced the original mimalloc.o in the SDK's AArch64 libc.a with the rebuilt object and regenerated the archive index.
ar r "$SDK/usr/lib/libc.a" mimalloc.o
ranlib "$SDK/usr/lib/libc.a"After recompiling the same Swift program using the modified SDK:
$ qemu-aarch64 -cpu cortex-a53 ./hello
Hello WorldA separate Swift program that retrieves the current user's information also executes successfully on the actual OpenWrt Cortex-A53 device:
root@OpenWrt:~# ./main
사용자: root
UID: 0
GID: 0
홈 디렉터리: /root
셸: /bin/ashThis confirms that replacing the SDK's mimalloc object with an ARMv8.0-compatible build resolves the observed crash, without modifying the Swift source code or rebuilding the entire Swift toolchain.
Related reports and work:
- Swift
aarch64-swift-linux-muslsupport forcortex-a53#88351 — Cortex-A53 compatibility with the Static Linux SDK - SIGILL --
ldaddal: Static Linux SDK binaries crash on the Raspberry Pi #93987 —ldaddalSIGILL in Static Linux SDK binaries - Static Linux SDK: aarch64 binaries crash with SIGILL on ARMv8.0 (Raspberry Pi 4) because mimalloc is built for armv8.1-a swift-docker#604 — Detailed mimalloc investigation and suggested fix
- Add static-linux sdk support for cortex A53 Arm CPU swift-docker#559 — Cortex-A53 support in the Static Linux SDK build scripts
It appears that the prebuilt Static Linux SDK distributed with Swift 6.4.2 still includes a mimalloc object that uses ARMv8.1-A instructions unconditionally.
Would it be possible to build the bundled mimalloc with MI_NO_OPT_ARCH=ON, or otherwise ensure ARMv8.0 compatibility for the default AArch64 Static Linux SDK?
Activity
wlstnals4028 commentedon Nov 14, 2026
I found that this issue has already been fixed by swiftlang/swift-docker#611, which was merged on November 9.
The fix is not included in the released Swift 6.4.2 Static Linux SDK, which explains why I was still able to reproduce the crash.
I'll close this issue as fixed upstream. Thanks!