Embedded `_Concurrency` is never built for `aarch64-none-none-elf` on a macOS host — arch filter omits the `aarch64` spelling
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- cmake, swift
- Bereich
- build-system, embedded-iot
Rechercherichtung
Beginne in stdlib/public/Concurrency/CMakeLists.txt beim macOS-Host-Architekturfilter und dem CPU-Define-Zweig und vergleiche anschließend die Einträge für eingebettete Targets in stdlib/public/CMakeLists.txt. Überprüfe, dass die Konfiguration libswift_Concurrency.a für aarch64-none-none-elf erstellt und dass der bestehende Pfad arm64-apple-none-macho unverändert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Description
What I have to do today. I'm running Embedded Swift with async/await on a bare-metal Raspberry Pi 4 (BCM2711, Cortex-A72). The natural target for a bare-metal AArch64 kernel is aarch64-none-none-elf — but that triple ships no libswift_Concurrency.a, so any use of Task / an async entry point fails to link. The only way I found to get the concurrency runtime onto the board is a workaround: target arm64-apple-none-macho instead (same AArch64 ISA, Mach-O container), -force_load its libswift_Concurrency.a, and post-process the Mach-O into a flat kernel8.img. It works — async/await and a custom SerialExecutor run fine on the hardware — but it means building a non-Apple-platform kernel through an Apple-platform triple purely to obtain _Concurrency.
The embedded concurrency build matrix is actively growing — this one entry looks left behind. In the 6.4 cycle, commit f161a60e1213 (2026-04-25) extended the macOS-host arch filter in stdlib/public/Concurrency/CMakeLists.txt to add the ARMv8-M targets (armv8m.main|armv8.1m.main), and 01ac09a1792e fixed SDK macro handling for non-Darwin embedded targets. So _Concurrency is being brought up across the embedded matrix — but aarch64 (the ELF spelling of ARM64) still isn't in the filter, so aarch64-none-none-elf is silently skipped.
Where it's missing — exact location (verified at release/6.4.x @ 9140a9cd4ec5):
- The triple is a first-class embedded stdlib target —
stdlib/public/CMakeLists.txt:241-244:if("AArch64" IN_LIST LLVM_TARGETS_TO_BUILD) list(APPEND EMBEDDED_STDLIB_TARGET_TRIPLES "aarch64 aarch64-none-none-elf aarch64-none-none-elf" ) - But
stdlib/public/Concurrency/CMakeLists.txt, inside theforeach(entry ${EMBEDDED_STDLIB_TARGET_TRIPLES})loop (line 304), drops it on the macOS host path (lines 322-325):elseif (SWIFT_HOST_VARIANT STREQUAL "macosx") if(NOT "${mod}" MATCHES "x86_64|arm64|arm64e|armv7|armv7m|armv7em|armv8m.main|armv8.1m.main") continue() # line 324 — mod="aarch64-none-none-elf" matches nothing here endif()arm64-apple-none-machomatchesarm64and proceeds;aarch64-none-none-elfmatches nothing (arm64is not a substring ofaarch64) andcontinue()s, never reaching itsadd_swift_target_library_single(embedded-concurrency-...). The Linux-host path (lines 318-321) only passes-linux-gnu$modules, so the triple is skipped there too. - A second miss with the same cause — the CPU-define branch (lines 337-338):
elseif("${arch}" MATCHES "arm64") list(APPEND extra_c_compile_flags -DTARGET_CPU_ARM64=1)archhere isaarch64, which doesn't matcharm64either.
I'm not sure whether this is intentional. I couldn't find any comment, test, or doc in the tree marking the ELF AArch64 triple as excluded from concurrency — a repo-wide search for aarch64-none-none-elf matches only its declaration in stdlib/public/CMakeLists.txt. And f161a60e1213 shows the filter line being actively extended for other embedded targets without aarch64 coming along, which reads like an oversight rather than a decision — but you'd know better than I would.
If it's not intentional, the fix appears to be two lines in stdlib/public/Concurrency/CMakeLists.txt:
- Add
aarch64to the host arch filter:"x86_64|aarch64|arm64|arm64e|armv7|...". - Make the CPU-define branch also match it:
elseif("${arch}" MATCHES "arm64|aarch64").
The architecturally identical Mach-O triple already builds and runs this runtime on real AArch64 hardware (that's my kernel), so there's no architectural blocker — only the triple-name filter. Closing it would let bare-metal AArch64 projects use concurrency on the native ELF target instead of routing through an Apple-platform triple.
Reproduction
On a stock Swift 6.4 development snapshot, on a macOS host, compare the embedded runtime dir for the two AArch64 triples:
# Mach-O AArch64 — the runtime archive exists:
ls <toolchain>/usr/lib/swift/embedded/arm64-apple-none-macho/libswift_Concurrency.a # present
# ELF AArch64 — never built:
ls <toolchain>/usr/lib/swift/embedded/aarch64-none-none-elf/libswift_Concurrency.a # absent
Any attempt to use async/await (Task, an async entry point) when targeting aarch64-none-none-elf then fails to link, because there is no libswift_Concurrency.a for that triple.
Expected behavior
aarch64-none-none-elf should get the Embedded _Concurrency runtime built for it on a macOS host, the same as the architecturally-identical arm64-apple-none-macho already does. Both are AArch64; there is no architectural reason only the Mach-O spelling ships async/await.
Environment
- Swift source verified:
release/6.4.x@ commit9140a9cd4ec5(2026-06-09), filesstdlib/public/CMakeLists.txtandstdlib/public/Concurrency/CMakeLists.txt. - Host: macOS.
- Hardware evidence toolchain:
swift-6.3.2-RELEASE, targetarm64-apple-none-macho.
Additional information
I have Embedded Swift async/await with a custom bare-metal SerialExecutor running on a real Raspberry Pi 4 (BCM2711, Cortex-A72), booting from kernel8.img on swift-6.3.2-RELEASE — project here: https://github.com/infektyd/AetherKernel (the workaround lives in Toolsets/rpi4-macho.json and build.sh). The only way I could get the _Concurrency runtime onto AArch64 was to target arm64-apple-none-macho and -force_load its libswift_Concurrency.a; the aarch64-none-none-elf path has no such archive to link — consistent with the continue() above. So the runtime demonstrably works on the architecture; the ELF triple just never gets it built.
Related: #87327 (Xcode 26.4 / TargetConditionals.h embedded build) touches the same macOS-host machinery — not a duplicate, just adjacent.
I'm happy to send the two-line PR if that's preferred — I'd appreciate guidance on how you'd want a build-configuration change like this tested, since there's no obvious unit-test hook.
- Vorherrschende Sprache
- Swift
- Sterne
- 70.4k
- Forks
- 10.8k
- Ø Merge
- 2 T. 2 Std.
- Gemergte PRs (30 T.)
- 461
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus swiftlang/swift
-
triage needed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
-
triage needed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
Foundation Windows
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
triage needed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Alle Issues in swiftlang/swift
Ähnliche Issues
-
type: docs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
googleapis/google-cloud-swift#971 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Move wallpaper setting Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
manaflow-ai/cmux#13417 ·
-
triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
ionic-team/capacitor#8616 ·