From abcbb1eebd2c7186e2f0e5683eec490b905b49c0 Mon Sep 17 00:00:00 2001
From: Huang Qi <huangqi3@xiaomi.com>
Date: Mon, 27 Jan 2025 22:43:38 +0800
Subject: [PATCH] tools/Rust.defs: Use 'gnu' target for Linux and 'darwin' for
 macOS

Summary:
- Updated `Rust.defs` to use `gnu` as the target for Linux systems and `darwin` for macOS systems
- This change aligns with Rust toolchain conventions, where `gnu` is used to declare the system environment rather than the actual ABI name (e.g., `sysv`)

Impact:
- No functional changes - the Rust toolchain interprets `gnu` correctly for Linux targets
- Improves consistency with Rust toolchain conventions and reduces potential confusion
- Maintains compatibility with existing Rust builds on Linux and macOS systems

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
---
 tools/Rust.defs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/Rust.defs b/tools/Rust.defs
index c3ca78298c797..42ccffb37c142 100644
--- a/tools/Rust.defs
+++ b/tools/Rust.defs
@@ -38,13 +38,13 @@ ifeq ($(CONFIG_ARCH_SIM),y)
   ifeq ($(CONFIG_HOST_LINUX),y)
     ifeq ($(LLVM_ARCHTYPE),x86)
       # Only for x86 based host or x64 but m32 build
-      RUSTFLAGS += --target i686-unknown-linux-$(LLVM_ABITYPE)
+      RUSTFLAGS += --target i686-unknown-linux-gnu
     else
       # For other archs, such as aarch64, arm etc
-      RUSTFLAGS += --target $(LLVM_ARCHTYPE)-unknown-linux-$(LLVM_ABITYPE)
+        RUSTFLAGS += --target $(LLVM_ARCHTYPE)-unknown-linux-gnu
     endif
   else ifeq ($(CONFIG_HOST_MACOS),y)
-    RUSTFLAGS += --target $(LLVM_ARCHTYPE)-apple-$(LLVM_ABITYPE)
+    RUSTFLAGS += --target $(LLVM_ARCHTYPE)-apple-darwin
   endif
 else ifeq ($(CONFIG_ARCH_RISCV),y)
   # Target triple is riscv[32|64][isa]-unknown-none-elf