1
Fork 0

Rollup merge of #135992 - madsmtm:new-target-docs, r=jieyouxu

Improve documentation when adding a new target

https://github.com/rust-lang/rust/pull/133631#issuecomment-2607877936 shows that it can be a bit difficult process-wise to add a new target.

I've added a bit of text to the docs, suggesting that users add the target defintion/spec first, and later work on `std` support.

I also found that we have two places where we document how to add a new target. I've linked these for now, but they should probably be merged somehow in the future.

`@rustbot` label A-docs
r? compiler
CC `@workingjubilee` who's worked a lot on target specs IIRC.
This commit is contained in:
Matthias Krüger 2025-01-31 12:28:16 +01:00 committed by GitHub
commit f818842ce2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View file

@ -4,8 +4,13 @@ These are a set of steps to add support for a new target. There are
numerous end states and paths to get there, so not all sections may be numerous end states and paths to get there, so not all sections may be
relevant to your desired goal. relevant to your desired goal.
See also the associated documentation in the
[target tier policy][target_tier_policy_add].
<!-- toc --> <!-- toc -->
[target_tier_policy_add]: https://doc.rust-lang.org/rustc/target-tier-policy.html#adding-a-new-target
## Specifying a new LLVM ## Specifying a new LLVM
For very new targets, you may need to use a different fork of LLVM For very new targets, you may need to use a different fork of LLVM

View file

@ -122,12 +122,23 @@ To propose addition of a new target, open a pull request on [`rust-lang/rust`]:
r? compiler r? compiler
``` ```
See also the documentation in the `rustc-dev-guide` on [adding a new target to
`rustc`][rustc_dev_guide_add_target].
Note that adding a new target that wants to support `std` would transitively
require `cc` and `libc` support. However, these would like to know about the
target from `rustc` as well. To break this cycle, you are strongly encouraged
to add a _minimal_ `#![no_core]` target spec first to teach `rustc` about the
target's existence, and add `std` support as a follow-up once you've added
support for the target in `cc` and `libc`.
[tier3example]: https://github.com/rust-lang/rust/pull/94872 [tier3example]: https://github.com/rust-lang/rust/pull/94872
[platform_template]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/TEMPLATE.md [platform_template]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/TEMPLATE.md
[summary]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/SUMMARY.md [summary]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/SUMMARY.md
[platformsupport]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support.md [platformsupport]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support.md
[rust_compiler_team]: https://www.rust-lang.org/governance/teams/compiler [rust_compiler_team]: https://www.rust-lang.org/governance/teams/compiler
[`rust-lang/rust`]: https://github.com/rust-lang/rust [`rust-lang/rust`]: https://github.com/rust-lang/rust
[rustc_dev_guide_add_target]: https://rustc-dev-guide.rust-lang.org/building/new-target.html
## Tier 3 target policy ## Tier 3 target policy