mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
tools/rust: Fix aarch64 NuttX Rust target specs
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 commit is contained in:
parent
efaebbba43
commit
7c38d58675
6 changed files with 79 additions and 18 deletions
|
|
@ -41,10 +41,14 @@ ifeq ($(CONFIG_ARCH_SIM),y)
|
|||
RUSTFLAGS += --target i686-unknown-linux-gnu
|
||||
else
|
||||
# For other archs, such as aarch64, arm etc
|
||||
RUSTFLAGS += --target $(LLVM_ARCHTYPE)-unknown-linux-gnu
|
||||
RUSTFLAGS += --target $(LLVM_ARCHTYPE)-unknown-linux-gnu
|
||||
endif
|
||||
else ifeq ($(CONFIG_HOST_MACOS),y)
|
||||
RUSTFLAGS += --target $(LLVM_ARCHTYPE)-apple-darwin
|
||||
ifeq ($(LLVM_ARCHTYPE),aarch64)
|
||||
RUSTFLAGS += --target $(TOPDIR)/tools/aarch64-unknown-nuttx-macho.json
|
||||
else
|
||||
$(error Unsupported Rust SIM target on macOS: LLVM_ARCHTYPE=$(LLVM_ARCHTYPE))
|
||||
endif
|
||||
endif
|
||||
else ifeq ($(CONFIG_ARCH_RISCV),y)
|
||||
# Target triple is riscv[32|64][isa]-unknown-none-elf
|
||||
|
|
|
|||
35
tools/aarch64-unknown-nuttx-macho.json
Normal file
35
tools/aarch64-unknown-nuttx-macho.json
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"arch": "aarch64",
|
||||
"archive-format": "darwin",
|
||||
"binary-format": "mach-o",
|
||||
"crt-objects-fallback": "false",
|
||||
"data-layout": "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32",
|
||||
"debuginfo-kind": "dwarf",
|
||||
"default-uwtable": true,
|
||||
"disable-redzone": true,
|
||||
"emit-debug-gdb-scripts": false,
|
||||
"features": "+v8a,+strict-align,+neon",
|
||||
"frame-pointer": "non-leaf",
|
||||
"function-sections": false,
|
||||
"linker-flavor": "gnu-lld",
|
||||
"lld-flavor": "darwin",
|
||||
"llvm-target": "arm64-apple-macosx",
|
||||
"max-atomic-width": 128,
|
||||
"metadata": {
|
||||
"description": "aarch64 Mach-O target for NuttX sim on macOS",
|
||||
"host_tools": false,
|
||||
"std": true,
|
||||
"tier": 3
|
||||
},
|
||||
"os": "nuttx",
|
||||
"panic-strategy": "abort",
|
||||
"split-debuginfo": "off",
|
||||
"stack-probes": {
|
||||
"kind": "inline"
|
||||
},
|
||||
"target-family": [
|
||||
"unix"
|
||||
],
|
||||
"target-pointer-width": 64,
|
||||
"vendor": "unknown"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue