-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mips64r6
and mips32r6
options to target_arch
#632
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. cc @rust-lang/compiler @rust-lang/compiler-contributors |
@rustbot second |
mips64r6
option to target_arch
mips64r6
and mips32r6
option to target_arch
mips64r6
and mips32r6
option to target_arch
mips64r6
and mips32r6
options to target_arch
- For details, see MCP rust-lang/compiler-team#632.
@rustbot label -final-comment-period +major-change-accepted |
add mips32r6 and mips64r6 target_arch detection This PR introduces `"mips32r6"` and `"mips64r6"` as valid `target_arch` values, and would be the arch values used by Tier-3 targets `mipsisa32r6-unknown-linux-gnu`, `mipsisa32r6el-unknown-linux-gnu`, `mipsisa64r6-unknown-linux-gnuabi64` and `mipsisa64r6el-unknown-linux-gnuabi64`. This PR is made for rust-lang/rust#112374. This PR has a corresponding [MCP](rust-lang/compiler-team#632) waiting for review. mips64r6 has the same ABIs, syscall conventions, and various magic numbers as mips64 does. So this PR just adds mips64r6 to all mips64 detection macros. Similarly, mips32r6 share their ABIs, syscall conventions and various magic with mips, so the PR just adds mips32r6 to where mips is to be detected.
- This is a part of the MCP rust-lang/compiler-team#632, that MIPS release 6 being migrated as target_arch instead of target features of MIPS.
add mips64r6 and mips32r6 as target_arch values This PR introduces `"mips32r6"` and `"mips64r6"` as valid `target_arch` values, and would be the arch value used by Tier-3 targets `mipsisa32r6-unknown-linux-gnu`, `mipsisa32r6el-unknown-linux-gnu`, `mipsisa64r6-unknown-linux-gnuabi64` and `mipsisa64r6el-unknown-linux-gnuabi64`. This PR was inspired by `rustix` attempting to link traditional mips64el objects with mips64r6el objects when building for mips64r6, even though `rustix` recently removed outline assembly support. This is because currently this target's `target_arch` is `"mips64"` and rustix has its respective assembly implementation as well as a pre-compiled little-endian static library prepared for mips64el, a tier-2 target with the same `target_arch`. After some [discussions on zulip](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20New.20Values.20To.20MIPS_ALLOWED_FEATURES.20compiler-team.23595), I decided to treat mips64r6 as an independent architecture from Rust's POV, since these two architectures are incompatible anyway. This PR is now waiting for `libc` to release a new version with [support](rust-lang/libc#3268) for these `target_arch` values. It is not expected to introduce changes to any other target, especially Tier-1 and Tier-2 targets. This PR has its corresponding [MCP](rust-lang/compiler-team#632) approved.
add mips64r6 and mips32r6 as target_arch values This PR introduces `"mips32r6"` and `"mips64r6"` as valid `target_arch` values, and would be the arch value used by Tier-3 targets `mipsisa32r6-unknown-linux-gnu`, `mipsisa32r6el-unknown-linux-gnu`, `mipsisa64r6-unknown-linux-gnuabi64` and `mipsisa64r6el-unknown-linux-gnuabi64`. This PR was inspired by `rustix` attempting to link traditional mips64el objects with mips64r6el objects when building for mips64r6, even though `rustix` recently removed outline assembly support. This is because currently this target's `target_arch` is `"mips64"` and rustix has its respective assembly implementation as well as a pre-compiled little-endian static library prepared for mips64el, a tier-2 target with the same `target_arch`. After some [discussions on zulip](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20New.20Values.20To.20MIPS_ALLOWED_FEATURES.20compiler-team.23595), I decided to treat mips64r6 as an independent architecture from Rust's POV, since these two architectures are incompatible anyway. This PR is now waiting for `libc` to release a new version with [support](rust-lang/libc#3268) for these `target_arch` values. It is not expected to introduce changes to any other target, especially Tier-1 and Tier-2 targets. This PR has its corresponding [MCP](rust-lang/compiler-team#632) approved.
* gen: add 32/64 MIPS Release 6 as separate target arch - This is a part of the MCP rust-lang/compiler-team#632, that MIPS release 6 being migrated as target_arch instead of target features of MIPS. * Introduce generated bindings for mipsr6 targets
* gen: add 32/64 MIPS Release 6 as separate target arch - This is a part of the MCP rust-lang/compiler-team#632, that MIPS release 6 being migrated as target_arch instead of target features of MIPS. * Introduce generated bindings for mipsr6 targets
Proposal
Tier-3 targets like
mipsisa64r6-unknown-linux-gnuabi64
andmipsisa64r6el-unknown-linux-gnuabi64
exist because their binaries are not compatible with those ofmips64-unknown-linux-gnuabi64
andmips64el-unknown-linux-gnuabi64
. MIPS R6 repurposes many opcodes for new instructions and introduces new instructions occupying reserved opcodes. It even changed its multiplication and division behavior, as it now uses separated instructions for upper and lower parts of the result, stores results in GPRs instead of a special register pair, and lets the microarchitecture optimize divide-and-remainder instruction sequences and low-high multiplication instruction sequences. In short, it doesn't just make sense to treat them as different targets, but as different architectures.The proposal is written because these targets'
target_arch
is"mips64"
, and the target_arch of 32-bit MIPS R6 targets is"mips"
. I'd like to change them to"mips64r6"
and"mips32r6"
respectively. Although"mips64"
and"mips"
work most of the time as both MIPS revisions share the same ABI, ioctl constants, etc., it makes rust programs difficult, if not impossible, to figure out whether they are being compiled for traditional MIPS or MIPS R6. In build.rs, you can check the TARGET or the HOST triples to see if you are targeting MIPS R6. But what if I want to conditionally enable features and dependencies in Cargo.toml?I also explored the possibility of adding
target_features
instead because that follows what the backends do. We ultimately decided against it because enabling such "features" inside a mips64 program would be possible and is pure nonsense. It also challenges what a "feature" should mean semantically. Existing architecture matching logic would continue to fail unless you match features after matching the architecture, and these "features" probably wouldn't stabilize when introduced, making them less useful anyway.Mentors or Reviewers
@bjorn3 @nagisa @workingjubilee @wesleywiser
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.
The text was updated successfully, but these errors were encountered: