Skip to content

Commit

Permalink
Rollup merge of rust-lang#130453 - randomPoison:trusty-x86, r=pnkfelix
Browse files Browse the repository at this point in the history
Add x86_64-unknown-trusty as tier 3 target

This PR adds a third target for the Trusty platform, `x86_64-unknown-trusty`.

Please let me know if an MCP is required. rust-lang/compiler-team#582 was made when adding the first two targets, I can make another one for the new target as well if needed.

# Target Tier Policy Acknowledgements

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

- Nicole LeGare (``@randomPoison)``
- Andrei Homescu (``@ahomescu)``
- Chris Wailes ([email protected])
- As a fallback [email protected] can be contacted

Note that this does not reflect the maintainers currently listed in [`trusty.md`](https://github.com/rust-lang/rust/blob/c52c23b6f44cd19718721a5e3b2eeb169e9c96ff/src/doc/rustc/src/platform-support/trusty.md). rust-lang#130452 is currently open to update the list of maintainers in the documentation.

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

The new target `x86_64-unknown-trusty` follows the existing naming convention for similar targets.

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

👍

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

There are no known legal issues or license incompatibilities.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

👍

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

This PR only adds the target. `std` support is being worked on and will be added in a future PR.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

👍

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via ``@)`` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

👍

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

👍

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.)

👍
  • Loading branch information
workingjubilee authored Oct 4, 2024
2 parents 53b0d54 + ae5d448 commit 044f924
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1830,6 +1830,7 @@ supported_targets! {

("armv7-unknown-trusty", armv7_unknown_trusty),
("aarch64-unknown-trusty", aarch64_unknown_trusty),
("x86_64-unknown-trusty", x86_64_unknown_trusty),

("riscv32i-unknown-none-elf", riscv32i_unknown_none_elf),
("riscv32im-risc0-zkvm-elf", riscv32im_risc0_zkvm_elf),
Expand Down
38 changes: 38 additions & 0 deletions compiler/rustc_target/src/spec/targets/x86_64_unknown_trusty.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Trusty OS target for X86_64.

use crate::spec::{
LinkSelfContainedDefault, PanicStrategy, RelroLevel, StackProbeType, Target, TargetOptions,
};

pub(crate) fn target() -> Target {
Target {
llvm_target: "x86_64-unknown-unknown-musl".into(),
metadata: crate::spec::TargetMetadata {
description: Some("x86_64 Trusty".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(false),
},
pointer_width: 64,
data_layout:
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
arch: "x86_64".into(),
options: TargetOptions {
executables: true,
max_atomic_width: Some(64),
panic_strategy: PanicStrategy::Abort,
os: "trusty".into(),
link_self_contained: LinkSelfContainedDefault::InferredForMusl,
position_independent_executables: true,
static_position_independent_executables: true,
crt_static_default: true,
crt_static_respected: true,
dynamic_linking: false,
plt_by_default: false,
relro_level: RelroLevel::Full,
stack_probes: StackProbeType::Inline,
mcount: "\u{1}_mcount".into(),
..Default::default()
},
}
}
1 change: 1 addition & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ target | std | host | notes
[`x86_64-unknown-hermit`](platform-support/hermit.md) | ✓ | | x86_64 Hermit
`x86_64-unknown-l4re-uclibc` | ? | |
[`x86_64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 64-bit OpenBSD
[`x86_64-unknown-trusty`](platform-support/trusty.md) | ? | |
`x86_64-uwp-windows-gnu` | ✓ | |
`x86_64-uwp-windows-msvc` | ✓ | |
[`x86_64-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 64-bit Windows 7 support
Expand Down
3 changes: 3 additions & 0 deletions tests/assembly/targets/targets-elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@
//@ revisions: x86_64_unknown_redox
//@ [x86_64_unknown_redox] compile-flags: --target x86_64-unknown-redox
//@ [x86_64_unknown_redox] needs-llvm-components: x86
//@ revisions: x86_64_unknown_trusty
//@ [x86_64_unknown_trusty] compile-flags: --target x86_64-unknown-trusty
//@ [x86_64_unknown_trusty] needs-llvm-components: x86
//@ revisions: x86_64_wrs_vxworks
//@ [x86_64_wrs_vxworks] compile-flags: --target x86_64-wrs-vxworks
//@ [x86_64_wrs_vxworks] needs-llvm-components: x86
Expand Down

0 comments on commit 044f924

Please sign in to comment.