Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add X86 target support for NuttX #136181

Closed
wants to merge 1 commit into from
Closed

Conversation

no1wudi
Copy link
Contributor

@no1wudi no1wudi commented Jan 28, 2025

  • Implement i686-unknown-nuttx and x86_64-unknown-nuttx target definitions
  • Integrate new targets into the platform support documentation
  • Update tests to include new target revisions

This change introduces support for 32-bit and 64-bit x86 architectures on the NuttX operating system, enhancing the range of platforms Rust can target. The targets are defined as tier 3, indicating that they are supported but not automatically tested by the Rust project. The i686-unknown-nuttx target uses the pentium4 CPU and 32-bit pointers, while the x86_64-unknown-nuttx target uses the x86-64 CPU and 64-bit pointers. Both targets disable dynamic linking and use inline stack probes for improved performance and reliability in a bare-metal environment.

Additionally, this commit updates the platform support documentation to list the new targets and includes them in the test suite to ensure that they build correctly.

@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2025

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2025

Some changes occurred in src/doc/rustc/src/platform-support

cc @Noratrieb

These commits modify compiler targets.
(See the Target Tier Policy.)

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Feb 4, 2025

☔ The latest upstream changes (presumably #136507) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, but seems okay to me otherwise.

@jieyouxu
Copy link
Member

jieyouxu commented Feb 5, 2025

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 5, 2025
@no1wudi
Copy link
Contributor Author

no1wudi commented Feb 5, 2025

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 5, 2025
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with or without the platform support doc nit.

* Implement `i686-unknown-nuttx` and `x86_64-unknown-nuttx` target definitions
* Integrate new targets into the platform support documentation
* Update tests to include new target revisions

This change introduces support for 32-bit and 64-bit x86 architectures on the NuttX operating system, enhancing the range of platforms Rust can target. The targets are defined as tier 3, indicating that they are supported but not automatically tested by the Rust project. The `i686-unknown-nuttx` target uses the `pentium4` CPU and 32-bit pointers, while the `x86_64-unknown-nuttx` target uses the `x86-64` CPU and 64-bit pointers. Both targets disable dynamic linking and use inline stack probes for improved performance and reliability in a bare-metal environment.

Additionally, this commit updates the platform support documentation to list the new targets and includes them in the test suite to ensure that they build correctly.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
@no1wudi
Copy link
Contributor Author

no1wudi commented Feb 5, 2025

Since you have questions about this, perhaps others have the same concerns. Therefore, it's best for us to include these remarks : )

@jieyouxu
Copy link
Member

jieyouxu commented Feb 5, 2025

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 5, 2025

📌 Commit 8340e5f has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 5, 2025
@workingjubilee
Copy link
Member

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 5, 2025
@workingjubilee
Copy link
Member

This PR will not pass CI. See #136146

Comment on lines +70 to +71
- On i686 (targeting i486 in NuttX), the FPU is typically disabled
- On x86_64, the FPU is enabled by default but can be disabled if needed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Rust, only one of these can be true per target. Pick.

use_ctors_section: true,
..Default::default()
};
base.cpu = "pentium4".into();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an i486 CPU, this is a 32-bit x86 CPU with SSE2 registers.

@workingjubilee workingjubilee self-assigned this Feb 5, 2025
@no1wudi
Copy link
Contributor Author

no1wudi commented Feb 6, 2025

@workingjubilee Thanks for your reminder. If it's now necessary to specify the ABI type and it cannot be modified using target-feature, then I'm considering temporarily closing this pull request and first use the custom target approach to support the x86 platform locally. This is because the x86 support in NuttX is still in its early stages, and these configurations have not yet stabilized.

@no1wudi no1wudi closed this Feb 6, 2025
@workingjubilee
Copy link
Member

Thanks for your reminder. If it's now necessary to specify the ABI type and it cannot be modified using target-feature

That is correct, the fact that the ABI could be modified was effectively a bug, unfortunately. You would need to rebuild the stdlib anyways to make it conform (although I am aware that it's probably always rebuilt in the current case).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants