Skip to content

Commit 67bcbde

Browse files
authored
Rollup merge of #90498 - joshtriplett:target-tier-policy-draft-updates, r=Mark-Simulacrum
Clarifications in the target tier policy We've added several targets since the introduction of the target tier policy. Based on experiences of those adding such targets, and discussions around such additions, clarify the target tier policy to make it easier to follow and work with. None of these changes substantively change the requirements on targets. (In some cases the changes do direct target submitters to follow specific process requirements for the addition of a target, such as how to respond to requirements, where to put target-specific documentation, or what should appear in that documentation. Those changes are procedural in nature and document the procedures we already direct people to follow.) - Clarify how to quote and respond to the target tier policy requirements. Several times, people have seemed unclear on how to respond to some of the policy requirements, particularly those that just state things the target developers must *not* do (e.g. not posting to PRs that break the target). Add a note that such requirements just need acknowledgement, nothing more. - Clarify dependency requirements in the face of cross-compilation. I previously phrased this confusingly in terms of "host tools", since that is the case where an exception applies (allowing proprietary target libraries commonly used by binaries for the target). Rephrase it to apply equally to cross-compilation. This doesn't change the net effect of the requirements, since other requirements already cover the dependencies of the Rust toolchain. - Clarify documentation about running binaries. The requirement for target documentation talks about "running tests", but tier 3 targets often don't support running the full testsuite, and in practice the documentation for how to run an individual binary may be more useful. Change "running tests" to "running binaries, or running tests". - Explain where to place target-specific documentation (a subdirectory of platform-support, with a link from the platform-support entry for the target). - Add a template for target-specific documentation.
2 parents ee5d8d3 + f863e4c commit 67bcbde

File tree

3 files changed

+80
-16
lines changed

3 files changed

+80
-16
lines changed

src/doc/rustc/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [JSON Output](json.md)
1414
- [Tests](tests/index.md)
1515
- [Platform Support](platform-support.md)
16+
- [Template for target-specific documentation](platform-support/TEMPLATE.md)
1617
- [aarch64-apple-ios-sim](platform-support/aarch64-apple-ios-sim.md)
1718
- [\*-kmc-solid_\*](platform-support/kmc-solid.md)
1819
- [x86_64-unknown-none](platform-support/x86_64-unknown-none.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# `target-name-here`
2+
3+
**Tier: 3**
4+
5+
One-sentence description of the target (e.g. CPU, OS)
6+
7+
## Target maintainers
8+
9+
- Some Person, `[email protected]`, https://github.com/...
10+
11+
## Requirements
12+
13+
Does the target support host tools, or only cross-compilation? Does the target
14+
support std, or alloc (either with a default allocator, or if the user supplies
15+
an allocator)?
16+
17+
Document the expectations of binaries built for the target. Do they assume
18+
specific minimum features beyond the baseline of the CPU/environment/etc? What
19+
version of the OS or environment do they expect?
20+
21+
Are there notable `#[target_feature(...)]` or `-C target-feature=` values that
22+
programs may wish to use?
23+
24+
What calling convention does `extern "C"` use on the target?
25+
26+
What format do binaries use by default? ELF, PE, something else?
27+
28+
## Building the target
29+
30+
If Rust doesn't build the target by default, how can users build it? Can users
31+
just add it to the `target` list in `config.toml`?
32+
33+
## Building Rust programs
34+
35+
Rust does not yet ship pre-compiled artifacts for this target. To compile for
36+
this target, you will either need to build Rust with the target enabled (see
37+
"Building the target" above), or build your own copy of `core` by using
38+
`build-std` or similar.
39+
40+
## Testing
41+
42+
Does the target support running binaries, or do binaries have varying
43+
expectations that prevent having a standard way to run them? If users can run
44+
binaries, can they do so in some common emulator, or do they need native
45+
hardware? Does the target support running the Rust testsuite?
46+
47+
## Cross-compilation toolchains and C code
48+
49+
Does the target support C code? If so, what toolchain target should users use
50+
to build compatible C code? (This may match the target triple, or it may be a
51+
toolchain for a different target triple, potentially with specific options or
52+
caveats.)

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

+27-16
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,22 @@ not preclude an existing target's maintainers using issues (on the Rust
6262
repository or otherwise) to track requirements that have not yet been met, as
6363
appropriate; however, before officially proposing the introduction or promotion
6464
of a target, it should meet all of the necessary requirements. A target
65-
proposal is encouraged to quote the corresponding requirements verbatim as part
66-
of explaining how the target meets those requirements.
65+
proposal must quote the corresponding requirements verbatim and respond to them
66+
as part of explaining how the target meets those requirements. (For the
67+
requirements that simply state that the target or the target developers must
68+
not do something, it suffices to acknowledge the requirement.)
6769

6870
For a list of all supported targets and their corresponding tiers ("tier 3",
6971
"tier 2", "tier 2 with host tools", "tier 1", or "tier 1 with host tools"), see
7072
[platform support](platform-support.md).
7173

74+
Several parts of this policy require providing target-specific documentation.
75+
Such documentation should typically appear in a subdirectory of the
76+
platform-support section of this rustc manual, with a link from the target's
77+
entry in [platform support](platform-support.md). Use
78+
[TEMPLATE.md](platform-support/TEMPLATE.md) as a base, and see other
79+
documentation in that directory for examples.
80+
7281
Note that a target must have already received approval for the next lower tier,
7382
and spent a reasonable amount of time at that tier, before making a proposal
7483
for promotion to the next higher tier; this is true even if a target meets the
@@ -139,17 +148,19 @@ approved by the appropriate team for that shared code before acceptance.
139148
or binary. In other words, the introduction of the target must not cause a
140149
user installing or running a version of Rust or the Rust tools to be
141150
subject to any new license requirements.
142-
- If the target supports building host tools (such as `rustc` or `cargo`),
143-
those host tools must not depend on proprietary (non-FOSS) libraries, other
144-
than ordinary runtime libraries supplied by the platform and commonly used
145-
by other binaries built for the target. For instance, `rustc` built for the
146-
target may depend on a common proprietary C runtime library or console
147-
output library, but must not depend on a proprietary code generation
148-
library or code optimization library. Rust's license permits such
149-
combinations, but the Rust project has no interest in maintaining such
150-
combinations within the scope of Rust itself, even at tier 3.
151-
- Targets should not require proprietary (non-FOSS) components to link a
152-
functional binary or library.
151+
- Compiling, linking, and emitting functional binaries, libraries, or other
152+
code for the target (whether hosted on the target itself or cross-compiling
153+
from another target) must not depend on proprietary (non-FOSS) libraries.
154+
Host tools built for the target itself may depend on the ordinary runtime
155+
libraries supplied by the platform and commonly used by other applications
156+
built for the target, but those libraries must not be required for code
157+
generation for the target; cross-compilation to the target must not require
158+
such libraries at all. For instance, `rustc` built for the target may
159+
depend on a common proprietary C runtime library or console output library,
160+
but must not depend on a proprietary code generation library or code
161+
optimization library. Rust's license permits such combinations, but the
162+
Rust project has no interest in maintaining such combinations within the
163+
scope of Rust itself, even at tier 3.
153164
- "onerous" here is an intentionally subjective term. At a minimum, "onerous"
154165
legal/licensing terms include but are *not* limited to: non-disclosure
155166
requirements, non-compete requirements, contributor license agreements
@@ -184,9 +195,9 @@ approved by the appropriate team for that shared code before acceptance.
184195
target not implementing those portions.
185196
- The target must provide documentation for the Rust community explaining how
186197
to build for the target, using cross-compilation if possible. If the target
187-
supports running tests (even if they do not pass), the documentation must
188-
explain how to run tests for the target, using emulation if possible or
189-
dedicated hardware if necessary.
198+
supports running binaries, or running tests (even if they do not pass), the
199+
documentation must explain how to run such binaries or tests for the target,
200+
using emulation if possible or dedicated hardware if necessary.
190201
- Tier 3 targets must not impose burden on the authors of pull requests, or
191202
other developers in the community, to maintain the target. In particular,
192203
do not post comments (automated or manual) on a PR that derail or suggest a

0 commit comments

Comments
 (0)