You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "no1wudi (via GitHub)" <gi...@apache.org> on 2026/03/13 06:51:18 UTC

[PR] Rust support for x86 [nuttx-apps]

no1wudi opened a new pull request, #3423:
URL: https://github.com/apache/nuttx-apps/pull/3423

   ## Summary
   This PR adds JSON-based target specification files for x86 and x86_64 architectures to enable Rust support on NuttX RTOS with proper target configuration.
   
   **Why change is necessary?**
   
   X86 support for Rust in NuttX is still under development and has not been upstreamed to the Rust compiler yet. The default Rust target triples for x86 architectures do not properly support NuttX-specific requirements such as soft-float, proper ABI settings, and NuttX-specific linker configurations.
   
   **What functional part of the code is being changed?**
   
   - Build system: `cmake/nuttx_add_rust.cmake` - Updated to use JSON target specification files for x86/x86_64 architectures
   - Build system: `tools/Rust.mk` - Updated build configuration
   - Target specifications: Added `tools/x86_64-unknown-nuttx.json` and `tools/i486-unknown-nuttx.json`
   **How does the change exactly work?**
   - Instead of using built-in Rust target triples (`x86_64-unknown-nuttx`, `i686-unknown-nuttx`), the build system now references custom JSON target specification files
   - These JSON files define:
     - Architecture-specific features (disabled MMX/SSE/AVX, enabled soft-float)
     - Proper data layout and ABI settings (`x86-softfloat`)
     - Linker configuration (rust-lld with gnu-lld flavor)
     - Position-independent executable support
     - Stack probing configuration
     - Sanitizer support (kcfi, kernel-address)
   - The CMake function `nuttx_rust_target_triple()` now returns the path to JSON files for x86 architectures
   - Build directory structure is enhanced to handle JSON target specifications by extracting the base target name
   **Key changes:**
   1. Added JSON files for i486 and x86_64 targets with complete target specifications
   2. Updated CMake functions to use the new target triples
   3. Enhanced build directory structure for Rust crates
   4. Fixed `target-pointer-width` type from string to numeric to comply with recent rustc JSON format requirements
   ## Impact
   - **Is new feature added? Is existing feature changed?**
     YES - New feature: Adds JSON-based target specification support for x86/x86_64 Rust builds on NuttX
   - **Impact on user (will user need to adapt to change)?**
     NO - This is a build system improvement that is transparent to end users. Developers building Rust applications for x86 NuttX targets will automatically benefit from the proper target configuration.
   - **Impact on build (will build process change)?**
     YES - The build process for Rust applications on x86/x86_64 architectures will now use custom JSON target specifications instead of relying on built-in Rust target triples. This provides more accurate and maintainable target configurations.
   - **Impact on hardware (will arch(s) / board(s) / driver(s) change)?**
     YES - Affects x86 and x86_64 architectures. Enables proper Rust support with soft-float and correct ABI settings for these architectures on NuttX.
   - **Impact on documentation (is update required / provided)?**
     NO - The change is internal to the build system and does not require documentation updates for general users.
   - **Impact on security (any sort of implications)?**
     NO - This change only affects build configuration and does not introduce security implications.
   - **Impact on compatibility (backward/forward/interoperability)?**
     NO - This is a new feature addition and does not break existing functionality. Future compatibility is improved as we can now maintain our own target specifications independent of Rust upstream.
   - **Anything else to consider?**
     Once x86 Rust support stabilizes and is upstreamed to the Rust compiler, we can consider removing these custom JSON files and using the built-in target triples.
   ## Testing
   I confirm that changes are verified on local setup and works as intended:
   **Build Host(s):**
   - OS: Linux (Ubuntu)
   - CPU: x86_64
   - Compiler: GCC, Rust (with x86 target support)
   **Target(s):**
   - arch: x86_64
   - board: sim (simulator)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Rust support for x86 [nuttx-apps]

Posted by "simbit18 (via GitHub)" <gi...@apache.org>.
simbit18 merged PR #3423:
URL: https://github.com/apache/nuttx-apps/pull/3423


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org