This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 9796690b7 apps/cmake: Fix aarch64 NuttX Rust target specs
9796690b7 is described below

commit 9796690b7b056fb0b3bc341e94681ff67dbce5f0
Author: Shoji Tokunaga <[email protected]>
AuthorDate: Thu May 28 12:24:24 2026 +0900

    apps/cmake: Fix aarch64 NuttX Rust target specs
    
    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 <[email protected]>
---
 cmake/nuttx_add_rust.cmake      | 17 ++++++++++-------
 tools/Rust.mk                   | 11 ++++++++---
 tools/i486-unknown-nuttx.json   | 33 ---------------------------------
 tools/x86_64-unknown-nuttx.json | 36 ------------------------------------
 4 files changed, 18 insertions(+), 79 deletions(-)

diff --git a/cmake/nuttx_add_rust.cmake b/cmake/nuttx_add_rust.cmake
index c8546f0fa..8978c84f3 100644
--- a/cmake/nuttx_add_rust.cmake
+++ b/cmake/nuttx_add_rust.cmake
@@ -35,7 +35,8 @@ include(nuttx_parse_function_args)
 #   - riscv64: riscv64imac/imafdc-unknown-nuttx-elf
 #   - x86: i686-unknown-nuttx
 #   - x86_64: x86_64-unknown-nuttx
-#   - aarch64: aarch64-apple-darwin
+#   - aarch64: aarch64-unknown-nuttx-macho for sim on macOS,
+#              aarch64-unknown-nuttx otherwise
 #
 # Inputs:
 #   ARCHTYPE - Architecture type (e.g. thumbv7m, riscv32)
@@ -48,15 +49,17 @@ include(nuttx_parse_function_args)
 # ~~~
 
 function(nuttx_rust_target_triple ARCHTYPE ABITYPE CPUTYPE OUTPUT)
-  get_filename_component(APPDIR "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/.."
-                         ABSOLUTE)
   if(ARCHTYPE STREQUAL "x86_64")
-    set(TARGET_TRIPLE "${APPDIR}/tools/x86_64-unknown-nuttx.json")
+    set(TARGET_TRIPLE "${PROJECT_SOURCE_DIR}/tools/x86_64-unknown-nuttx.json")
   elseif(ARCHTYPE STREQUAL "x86")
-    set(TARGET_TRIPLE "${APPDIR}/tools/i486-unknown-nuttx.json")
+    set(TARGET_TRIPLE "${PROJECT_SOURCE_DIR}/tools/i486-unknown-nuttx.json")
   elseif(ARCHTYPE STREQUAL "aarch64")
-    if(APPLE)
-      set(TARGET_TRIPLE "aarch64-apple-darwin")
+    if(CONFIG_ARCH_SIM AND CONFIG_HOST_MACOS)
+      set(TARGET_TRIPLE
+          "${PROJECT_SOURCE_DIR}/tools/aarch64-unknown-nuttx-macho.json")
+    else()
+      set(TARGET_TRIPLE
+          "${PROJECT_SOURCE_DIR}/tools/aarch64-unknown-nuttx.json")
     endif()
   elseif(ARCHTYPE MATCHES "thumb")
     if(ARCHTYPE MATCHES "thumbv8m")
diff --git a/tools/Rust.mk b/tools/Rust.mk
index 3a5f72806..90f3615a2 100644
--- a/tools/Rust.mk
+++ b/tools/Rust.mk
@@ -37,6 +37,8 @@
 #   - thumbv8m.base: thumbv8m.base-nuttx-eabi, thumbv8m.base-nuttx-eabihf
 #   - riscv32: riscv32imc/imac/imafc-unknown-nuttx-elf
 #   - riscv64: riscv64imac/imafdc-unknown-nuttx-elf
+#   - aarch64: aarch64-unknown-nuttx-macho for sim on macOS,
+#              aarch64-unknown-nuttx otherwise
 #
 # Usage:   $(call RUST_TARGET_TRIPLE)
 #
@@ -47,13 +49,16 @@
 define RUST_TARGET_TRIPLE
 $(or \
   $(and $(filter x86_64,$(LLVM_ARCHTYPE)), \
-    $(APPDIR)/tools/x86_64-unknown-nuttx.json \
+    $(TOPDIR)/tools/x86_64-unknown-nuttx.json \
   ), \
   $(and $(filter x86,$(LLVM_ARCHTYPE)), \
-    $(APPDIR)/tools/i486-unknown-nuttx.json \
+    $(TOPDIR)/tools/i486-unknown-nuttx.json \
   ), \
   $(and $(filter aarch64,$(LLVM_ARCHTYPE)), \
-    $(if $(filter y,$(CONFIG_HOST_MACOS)),aarch64-apple-darwin) \
+    $(if $(and $(filter sim,$(CONFIG_ARCH)),$(filter y,$(CONFIG_HOST_MACOS))), 
\
+      $(TOPDIR)/tools/aarch64-unknown-nuttx-macho.json, \
+      $(TOPDIR)/tools/aarch64-unknown-nuttx.json \
+    ) \
   ), \
   $(and $(filter thumb%,$(LLVM_ARCHTYPE)), \
     $(if $(filter thumbv8m%,$(LLVM_ARCHTYPE)), \
diff --git a/tools/i486-unknown-nuttx.json b/tools/i486-unknown-nuttx.json
deleted file mode 100644
index 93cd43418..000000000
--- a/tools/i486-unknown-nuttx.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
-  "arch": "x86",
-  "cpu": "i486",
-  "crt-objects-fallback": "false",
-  "data-layout": 
"e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",
-  "features": 
"-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float",
-  "default-dwarf-version": 2,
-  "dynamic-linking": true,
-  "has-rpath": true,
-  "has-thread-local": true,
-  "linker-flavor": "gnu-lld",
-  "llvm-target": "i486-unknown-nuttx",
-  "max-atomic-width": 64,
-  "metadata": {
-    "description": "32-bit x86, resricted to i486",
-    "host_tools": false,
-    "std": true,
-    "tier": 3
-  },
-  "no-default-libraries": true,
-  "os": "nuttx",
-  "position-independent-executables": false,
-  "relro-level": "full",
-  "rustc-abi": "x86-softfloat",
-  "stack-probes": {
-    "kind": "inline"
-  },
-  "target-family": [
-    "unix"
-  ],
-  "target-mcount": "__mcount",
-  "target-pointer-width": 32
-}
diff --git a/tools/x86_64-unknown-nuttx.json b/tools/x86_64-unknown-nuttx.json
deleted file mode 100644
index d12fecb8a..000000000
--- a/tools/x86_64-unknown-nuttx.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
-  "arch": "x86_64",
-  "cpu": "x86-64",
-  "crt-objects-fallback": "false",
-  "data-layout": 
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
-  "disable-redzone": true,
-  "features": 
"-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float",
-  "linker": "rust-lld",
-  "linker-flavor": "gnu-lld",
-  "llvm-target": "x86_64-unknown-nuttx",
-  "max-atomic-width": 64,
-  "metadata": {
-    "description": "x86_64 target for NuttX RTOS with softfloat",
-    "host_tools": false,
-    "std": true,
-    "tier": 3
-  },
-  "panic-strategy": "abort",
-  "plt-by-default": false,
-  "position-independent-executables": true,
-  "relro-level": "full",
-  "rustc-abi": "x86-softfloat",
-  "stack-probes": {
-    "kind": "inline"
-  },
-  "static-position-independent-executables": true,
-  "supported-sanitizers": [
-    "kcfi",
-    "kernel-address"
-  ],
-  "os": "nuttx",
-  "target-family": [
-    "unix"
-  ],
-  "target-pointer-width": 64
-}
\ No newline at end of file

Reply via email to