tools/rust: Fix aarch64 NuttX Rust target specs#18992
Merged
Merged
Conversation
Add a custom aarch64 Mach-O Rust target for macOS sim builds and use it instead of an Apple Darwin Rust target. This keeps Rust cfg values aligned with NuttX while producing Mach-O objects required by the simulator link. Also align sim host handling for aarch64 Linux by detecting `aarch64` as `HOST_ARM64` and avoiding x86-specific `-mcmodel` and `-no-pie` options on ARM64 hosts. Signed-off-by: Shoji Tokunaga <toku@mac.com>
This was referenced May 29, 2026
Member
|
@no1wudi Could you review this PR? And also this one below thanks :-) |
xiaoxiang781216
approved these changes
May 29, 2026
jerpelea
approved these changes
May 29, 2026
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
Previously, sim builds on Apple Silicon used aarch64-apple-darwin as
the Rust target, which sets target_os=macos and breaks NuttX-specific
conditional compilation.
This PR introduces tools/aarch64-unknown-nuttx-macho.json, a custom
Rust target that sets os=nuttx while producing Mach-O objects
compatible with the macOS simulator linker. tools/Rust.defs is updated
to select this target when building sim on macOS.
Impact
Allows proper building of sim on Apple Silicon Macs and aarch64 Linux.
(Support for Intel Macs will be considered separately.)
Testing
I confirm that changes are verified on local setup and works as intended:
Configuration and Build:
Testing logs before change:
Testing logs after change:
PR verification Self-Check