Add Arm64_32 variant to Aarch64Architecture for arm64_32-apple-watchos#131
Merged
fitzgen merged 1 commit intoMay 12, 2026
Merged
Conversation
Apple Watch from Series 4 onward uses the AArch64 ISA with an ILP32 ABI (32-bit pointers, 64-bit registers), exposed via the `arm64_32-apple-watchos` Rust target triple. The `arm64_32` arch token isn't a `gnu_ilp32`-style environment qualifier — Apple/LLVM treat it as its own architecture name — so model it as a third variant of `Aarch64Architecture` with `pointer_width() = U32` and `endianness() = Little`. Also enables the `arm64_32-apple-watchos` entry in the roundtrip_known_triples test (previously commented out as TODO).
Member
|
cc @fitzgen, would you be able to review/merge this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a third
Arm64_32variant toAarch64Architectureso thearm64_32-apple-watchosRust target triple round-trips throughTriple::from_str/Display.Apple Watch Series 4+ ships an AArch64 ISA with an ILP32 ABI: 64-bit
registers, 32-bit pointers. Apple/LLVM treat the arch token as
arm64_32(not as agnu_ilp32-style environment qualifier the wayLinux does). The current crate exposes only
Aarch64andAarch64be,both hardcoded to
pointer_width = U64, so any consumer that callsTriple::from_str("arm64_32-apple-watchos")panics withInvalid target name. There is a// TODOplaceholder for this triplein the
roundtrip_known_triplestest that this PR un-comments.Why this matters
Without this patch nothing in the bytecodealliance ecosystem can build
for arm64_32-apple-watchos —
wasmtime/craneliftconsumetarget-lexicontransitively throughwasmtime-environand others,and their build scripts call
Triple::from_str(env!(\"TARGET\")). Thepanic surfaces during
cargo build --target arm64_32-apple-watchosbefore any target-side code is even attempted.
This is the same pattern as the existing
aarch64-apple-watchos/aarch64-apple-watchos-simentries — those are aarch64 with U64pointers; arm64_32 is the same ISA with U32 pointers.
What changed
Aarch64Architecture::Arm64_32(with a doc commentexplaining the Apple/LLVM naming convention).
pointer_width()returnsU32for the new variant,U64for theexisting two — preserving the doc note that this method is
normally arch-only and ILP32-blind, with an explicit carve-out for
arm64_32 (which Apple models as its own arch, not via environment).
endianness()returnsLittle.into_str()returns\"arm64_32\"soDisplay/to_string()round-trip the original token.
is_thumb()returnsfalse(consistent with the other AArch64variants).
Aarch64Architecture::FromStraccepts\"arm64_32\".\"arm64_32-apple-watchos\"entry that was already there as a// TODOplaceholder.Test
cargo test— all 14 tests pass, includingroundtrip_known_tripleswhich exercises the new triple.Verified end-to-end on real hardware
This patch is one of three needed to build wasmtime+Pulley as a static
library for
arm64_32-apple-watchos. The combined stack has beendeployed to a real Apple Watch SE 2 (S8 SoC, watchOS 11.6.2), where
all 11 wasm benchmarks (recursive fib, tail-call fib, sieve, CRC32,
two SIMD matmuls, convolution, audio-DSP, bulk-memory, call_indirect)
run with byte-identical results to their host references.