apps/cmake: Fix aarch64 NuttX Rust target specs#3510
Open
toku-mac wants to merge 1 commit into
Open
Conversation
2 tasks
| "arch": "aarch64", | ||
| "archive-format": "darwin", | ||
| "binary-format": "mach-o", | ||
| "crt-objects-fallback": "false", |
Contributor
There was a problem hiding this comment.
should we reuse the same file from nuttx git?
Contributor
Author
There was a problem hiding this comment.
Is your intention the same as the patch below?
Also, should I move tools/aarch64-unknown-nuttx.json to the nuttx git as well?
diff --git a/cmake/nuttx_add_rust.cmake b/cmake/nuttx_add_rust.cmake
index dfa91c31c..2c28983f0 100644
--- a/cmake/nuttx_add_rust.cmake
+++ b/cmake/nuttx_add_rust.cmake
@@ -57,7 +57,8 @@ function(nuttx_rust_target_triple ARCHTYPE ABITYPE CPUTYPE OUTPUT)
set(TARGET_TRIPLE "${APPDIR}/tools/i486-unknown-nuttx.json")
elseif(ARCHTYPE STREQUAL "aarch64")
if(CONFIG_ARCH_SIM AND CONFIG_HOST_MACOS)
- set(TARGET_TRIPLE "${APPDIR}/tools/aarch64-unknown-nuttx-macho.json")
+ set(TARGET_TRIPLE
+ "${PROJECT_SOURCE_DIR}/tools/aarch64-unknown-nuttx-macho.json")
else()
set(TARGET_TRIPLE "${APPDIR}/tools/aarch64-unknown-nuttx.json")
endif()
diff --git a/tools/Rust.mk b/tools/Rust.mk
index 9ca03bdac..4fc74af4e 100644
--- a/tools/Rust.mk
+++ b/tools/Rust.mk
@@ -56,7 +56,7 @@ $(or \
), \
$(and $(filter aarch64,$(LLVM_ARCHTYPE)), \
$(if $(and $(filter sim,$(CONFIG_ARCH)),$(filter y,$(CONFIG_HOST_MACOS))), \
- $(APPDIR)/tools/aarch64-unknown-nuttx-macho.json, \
+ $(TOPDIR)/tools/aarch64-unknown-nuttx-macho.json, \
$(APPDIR)/tools/aarch64-unknown-nuttx.json \
) \
), \Add aarch64 Rust target specs for NuttX, including a Mach-O variant for macOS sim builds. Use the NuttX custom targets instead of aarch64-apple-darwin so Rust std is built with target_os=nuttx while still producing link-compatible objects for sim. Signed-off-by: Shoji Tokunaga <toku@mac.com>
77b62fc to
6e58319
Compare
Contributor
Author
|
Since the PR on the nuttx git repository has been merged into master, I've decided not to move the |
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, aarch64 sim builds on macOS used aarch64-apple-darwin,
which sets target_os=macos and causes NuttX-specific cfg guards to be silently skipped.
This PR adds two custom Rust target JSON files:
Rust.mk and cmake/nuttx_add_rust.cmake are updated to select the
appropriate target.
Depends on the corresponding nuttx-side PR. #18992
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:
PR verification Self-Check