Skip to content

Commit a67c995

Browse files
authored
Unrolled build for rust-lang#135992
Rollup merge of rust-lang#135992 - madsmtm:new-target-docs, r=jieyouxu Improve documentation when adding a new target rust-lang#133631 (comment) 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.
2 parents aa4cfd0 + 7df38d9 commit a67c995

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/doc/rustc-dev-guide/src/building/new-target.md

+5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ These are a set of steps to add support for a new target. There are
44
numerous end states and paths to get there, so not all sections may be
55
relevant to your desired goal.
66

7+
See also the associated documentation in the
8+
[target tier policy][target_tier_policy_add].
9+
710
<!-- toc -->
811

12+
[target_tier_policy_add]: https://doc.rust-lang.org/rustc/target-tier-policy.html#adding-a-new-target
13+
914
## Specifying a new LLVM
1015

1116
For very new targets, you may need to use a different fork of LLVM

src/doc/rustc/src/target-tier-policy.md

+11
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,23 @@ To propose addition of a new target, open a pull request on [`rust-lang/rust`]:
122122
r? compiler
123123
```
124124

125+
See also the documentation in the `rustc-dev-guide` on [adding a new target to
126+
`rustc`][rustc_dev_guide_add_target].
127+
128+
Note that adding a new target that wants to support `std` would transitively
129+
require `cc` and `libc` support. However, these would like to know about the
130+
target from `rustc` as well. To break this cycle, you are strongly encouraged
131+
to add a _minimal_ `#![no_core]` target spec first to teach `rustc` about the
132+
target's existence, and add `std` support as a follow-up once you've added
133+
support for the target in `cc` and `libc`.
134+
125135
[tier3example]: https://github.com/rust-lang/rust/pull/94872
126136
[platform_template]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/TEMPLATE.md
127137
[summary]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/SUMMARY.md
128138
[platformsupport]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support.md
129139
[rust_compiler_team]: https://www.rust-lang.org/governance/teams/compiler
130140
[`rust-lang/rust`]: https://github.com/rust-lang/rust
141+
[rustc_dev_guide_add_target]: https://rustc-dev-guide.rust-lang.org/building/new-target.html
131142

132143
## Tier 3 target policy
133144

0 commit comments

Comments
 (0)