-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
added support for s390x target features soft-float and packed-stack
#150766
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that further up this file it still says ("soft-float", Forbidden { reason: "currently unsupported ABI-configuration feature" }, &[]),So using the soft-float target feature still doesn't work even with this PR.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On that note, it would be great to have codegen tests for these kind of flags. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1211,11 +1211,13 @@ impl Target { | |
| } | ||
| } | ||
| Arch::S390x => { | ||
| // We don't currently support a softfloat target on this architecture. | ||
| // As usual, we have to reject swapping the `soft-float` target feature. | ||
| // The "vector" target feature does not affect the ABI for floats | ||
| // because the vector and float registers overlap. | ||
| FeatureConstraints { required: &[], incompatible: &["soft-float"] } | ||
| // On s390x only the hard-float ABI is valid. However for kernel compilation we need to | ||
| // allow soft-float if and only if the ABI is explicitly set to soft-float. | ||
|
Comment on lines
+1214
to
+1215
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this refer to the linux kernel? Also I feel like this mixes up the |
||
| if matches!(self.abi, Abi::SoftFloat) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It looks like s390x is just as bad as x86 when it comes to ABI handling so the logic should probably be similar?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is only one valid abi on s390x. This ABI uses The idea is that It is used as a gate, so if you want to use soft-float you also have to explicitly change the ABI. And make it clear that this code is incompatible with the normal code. Footnotes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What exactly do you mean by this - floats still get passed in vregs even with
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There might only be one official ABI, but the soft-float ABI is real and we're not going to pretend that it isn't. The soft-float ABI is whatever LLVM does to pass float args across function barriers when the That's what happened on x86, anyway. I suspect it is similar on s390x.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Exactly. But (Well, that's not entirely true.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fneddy I assume that by saying there is only "one" "valid" ABI, you may be trying to say something like "the soft-float ABI is not required to be stable, as it is an implementation detail of the (Linux?) kernel, which is allowed to have an unstable ABI that changes from version to version"? If so, that is not something very important to us here. That describes the situation for Rust too. For the Rust compiler's purposes, all that matters is that an ABI can be used by anything for an external call. Sometimes Linux code calls across kernel object boundaries, and sometimes Rust code calls across object boundaries, too. They both manage, despite the need to recompile everything per-version. Stability between compiler or kernel versions is not a required component for us to care about an ABI.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...it does technically mean that any Rust target tuple supported since around 2015 has at least 3652... eh, 3660? Rust ABIs. "Legally" speaking, of course, we aren't changing every target's code literally every night. |
||
| FeatureConstraints { required: &["soft-float"], incompatible: &[] } | ||
| } else { | ||
| FeatureConstraints { required: &[], incompatible: &["soft-float"] } | ||
| } | ||
| } | ||
| _ => NOTHING, | ||
| } | ||
|
|
||
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.
What are the ABI considerations for this flag? Is it possible to freely mix code built with and without this flag? If not, it needs to be made a "target modifier" to avoid unsoundness.
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.
yes packed-stack and non packed stack code can be mixed. It just affects the calling code and not the called code.