-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RFC: Add target_abi
configuration
#2992
Conversation
text/0000-cfg-target-abi.md
Outdated
# Reference-level explanation | ||
[reference-level-explanation]: #reference-level-explanation | ||
|
||
`target_abi` is a key-value option set once with the target's ABI. The value is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does rustc already have the concept of target ABI internally? If not it seems really important to spell out how exactly this is defined. The concept of ABIs is really poorly understood by developers in my experience. Obviously there's a 1:1 mapping of target : ABI, but the inverse mapping is a little fuzzy to me and I'm not sure how useful it is in practice.
For example, I'm not really aware of an existing convention for talking about the "x86-64 System V ABI" despite it being the ABI used in both x86-64 Linux and macOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically what I'm interested in is the component that comes after target_env
in the triple string. What it indicates varies greatly between different targets. On some targets, it indicates the availability of hardware floats (e.g. eabihf
for embedded abi, hardware float). On others, it indicates the running environment (e.g. x86_64-apple-ios-macabi
for iOS apps that target macOS).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To answer my own question, yes it does:
https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/abi/enum.Abi.html
However, this enum seems a lot more like it's describing "calling convention" than "ABI".
So I definitely understand the motivation here: to distinguish between "iOS Simulator" and "iOS on macOS (Catalyst)" at build time, since they are otherwise both targeting the same CPU and OS. Looking at the two built-in specs: Effectively the only differences are:
However I note that
I think you could make a pretty compelling argument for setting |
I think |
We discussed this in the @rust-lang/lang meeting today. We're entirely in favor of doing this, and we just had one question: Does this propose to change the value of If there's no compatibility break here, then 👍 for this RFC. |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
If you're talking about targets like ARM, where the RFC says:
ARM Linux already has a simple |
@rfcbot reviewed |
@cuviper Sounds reasonable. Could you please file an issue that lists the targets you found? We should also search the crater code corpus for instances of those target names to evaluate impact. And we should add some documentation in the codebase in places people will see when adding a new target, to make it clear that @rfcbot resolved compatibility |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
Huzzah! The @rust-lang/lang team has decided to accept this RFC. To track further discussion, subscribe to the tracking issue here: |
This proposes a new
cfg
:target_abi
, which specifies certain aspects of the target's Application Binary Interface (ABI). This also adds aCARGO_CFG_TARGET_ABI
environment variable for parity with otherCARGO_CFG_TARGET_*
variables.Rendered