Closed joshtriplett closed 3 years ago
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
cc @rust-lang/compiler @rust-lang/compiler-contributors
(Fixed the issue title, and the Zulip stream link.)
@rustbot second
@rustbot label -final-comment-period +major-change-accepted
I plan to work to get this target to tier 2, but the target needs to start out at tier 3 and work its way up.
@joshtriplett , how can I help get this to Tier 2?
@bstrie I think it needs a combination of an MCP that documents the target meeting the tier 2 requirements, and a draft PR to rust-lang/rust CI adding a build of it.
This compiler MCP proposes a new target,
x86_64-unknown-none
, for standalone or "freestanding" x86-64 binaries with no operating system, using ELF as the object format. This target is intended for firmware, kernels, modules, and other software running without an operating system.This target will not provide an implementation of
std
, since that would depend on an operating system. This target will not provide a default allocator, but can provide an implementation ofalloc
if the user of the target supplies an allocator.The
x86_64-unknown-none
target will default to not allowing the use of any vector or floating-point registers, because kernels, modules, and similar software needs special care to use such registers. For instance, the Linux kernel normally optimizes the entry and exit of the kernel by not saving and restoring such registers; kernel code must explicitly request the use of such registers before running code that uses them, and once requested, the kernel must pay the additional overhead of saving the userspace registers to make way for the kernel usage. Users of thex86_64-unknown-none
target can still opt into the use of such registers via thetarget-feature
mechanism, either for an entire program or for individual functions.This target has a lot in common with
x86_64-unknown-none-linuxkernel
, but is intended to be general enough to work for any standalone/freestanding software without requiring a specific target for each such environment.I plan to work to get this target to tier 2, but the target needs to start out at tier 3 and work its way up.
Checking off the target tier policy requirements for tier 3:
Harald Hoyer harald@profian.com, https://github.com/haraldh Mike Leany, https://github.com/mikeleany
Standalone targets have had a variety of names in different compilers. Some compilers and embedded toolchains use the name
x86_64-unknown-elf
for such targets; in other toolchains, however,-elf
may imply some minimal amount of C library support. Rust has several standalone targets for various architectures; RISC-V standalone targets usenone-elf
(e.g.riscv64gc-unknown-none-elf
), while most other standalone targets use justnone
(e.g.aarch64-unknown-none
,mipsel-unknown-none
) ornone
with an unrelated suffix for the ABI (e.g.armv7r-none-eabi
,armv7a-none-eabi
). There is also precedent in the form of thex86_64-unknown-none-linuxkernel
andx86_64-unknown-none-hermitkernel
targets.This target proposal chooses to use
x86_64-unknown-none
, to avoid any connotations of library support, for consistency with more existing Rust targets, and for consistency with the existing Rustx86_64
kernel-specific targets.✅ The
x86_64-unknown-none
target will not introduce any legal issues or new legal terms.✅ The
x86_64-unknown-none
target will not introduce any new dependencies or licenses at all.MIT OR Apache-2.0
).✅ The pull requests adding and maintaining this target will of course be under the standard Rust license.
tidy
tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.✅ This target adds no new dependencies of any kind.
rustc
orcargo
), those host tools must not depend on proprietary (non-FOSS) libraries, other than ordinary runtime libraries supplied by the platform and commonly used by other binaries built for the target. For instance,rustc
built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.✅ The target will not support host tools (nor does the target have any proprietary libraries, or any libraries at all).
✅ The target will use a normal toolchain.
✅ Understood.
✅
I'm being paid to work on this target. I am not part of any approval decisions regarding the tier status of the target.
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.✅ The
x86_64-unknown-none
target will implementcore
, and will support users usingalloc
with their own memory allocator. Thex86_64-unknown-none
target will not supportstd
, and will not provide a default memory allocator.✅ Building for the target does not require any special considerations. However, for completeness, the PR adding the target will provide documentation to that effect.
The target does not support running tests.
@
) to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.✅ Understood.
✅ This target has some common functionality with the
x86_64-unknown-none-linuxkernel
target. After adding thex86_64-unknown-none
target, a follow-up PR may coordinate with the maintainers of the Linux kernel target to share this functionality. The addition ofx86_64-unknown-none
will not knowingly break any other target.Work sponsored by Profian.
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.