-
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 target_abi = "[ilp]{2,3}[3264]{2}[fdq]?"
to all RV[3264]{2}I targets
#830
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. Concerns or objections to the proposal should be discussed on Zulip and formally registered here by adding a comment with the following syntax:
Concerns can be lifted with:
See documentation at https://forge.rust-lang.org cc @rust-lang/compiler |
LGTM. We rely on a I am far from an expert on the Rust compiler workflow, but will try to catch up and contribute here. |
From the latest specification, it looks like there is/will be The restriction for not combining |
See the rustbot message above. |
Ah, thanks @Noratrieb, maybe you could ask @workingjubilee to open the Zulip thread?
Notice how all of the Zulip links simply link back to this issue? |
I've fixed the issue description, the link goes the right place now. I'm sure Jubilee just pasted the wrong link into the issue description. The link in the comment by rustbot has always been correct. |
Proposal
We added
target_abi
specifically to cover differences between soft float and hard float ABIs in targets, and potentially other interesting ABI differences. Here, we would simply add the appropriatetarget_abi
string to all the RISCV targets that we support, essentially directly copied from the RISCV ABI spec for how these should be written:f32
to be passed in registersf64
to be passed in registersf32
in registersf64
to be passed in registersf128
can be passed directly in registers)f32
in registers. Note that this ABI can be executed on an RV32IF CPU.NOTE: Approval of this MCP does not constitute implicit approval of adding targets that use all of the above
target_abi
strings. Only those with a checkmark are present in the codebase, and only those would be approved for now. This can already be observed because thetarget_abi
will match whatever thellvm_abiname
would be for a RISCV target: https://github.com/search?q=repo%3Arust-lang%2Frust+llvm_abiname&type=codeThis was already done for the riscv32e targets in rust-lang/rust#134358 as they were added on an experimental basis, and otherwise there is no meaningful way to write a
cfg
option that distinguished between the RV32E or RV32I targets. They would have to usecfg(target_feature)
with an unstable feature, and due to how the "feature" works it might not be something that actually makes sense or is correct, and may not be something we want to expose as atarget_feature
in actuality.There is only one drawback of doing this: if some OS target expects to be able to use something like
target_abi = "macabi"
, then this conflicts with the RISCV usage. There are numerous reasons this is not a substantial drawback:'a'
,'b'
, and 'i'
in the string, placed in direct succession of each other,target_abi = "macabi"
is more about the software environment ("build iOS apps slightly differently so they run on a host that has macOS libraries"), which is usually described viatarget_env
. As some other mechanism should probably have been used to expresstarget_abi = "macabi"
, we should discourage such uses anyways, as they invite confusion.target_abi = "macabi"
has very little to do with the calling convention or stack layout, which other uses oftarget_abi
, predating the RV32E targets, do describe, such astarget_abi = "eabihf"
ortarget_abi = "eabi"
for all the 32-bit Arm targets. In other words, this drawback already existed whentarget_abi = "macabi"
was added, and using the same slot for conflicting meanings was not discussed to any extent that I am aware of.target_abi
almost invariably do imply an actual ABI, because they are used for a very particular target variance, so the issue described above is a philosophical but not practical concern: there is no expected case where atarget_abi
would imply two different RISCV ABIs, even if the Darwin kernel (or NT kernel, for that matter) is ported to RISCV.As a reminder, please take discussion to the Zulip thread.
This is an MCP because: it adds to the definition of a bunch of tier 2 targets in a strongly precedent-setting but additive way. It seems consistent with using the
target_abi
string as, er, the string that describes the ABI used by software for the target. Room for uncertainty is mostly because RFC 2992 is somewhat sparse on explaining "so what is an actual ABI difference that should require us to pick a specifictarget_abi
string?" I present this opinion for how this should be done for the RISCV targets based on my research and expertise.Mentors or Reviewers
As a reminder, please take discussion to the Zulip thread.
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: