Skip to content
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

PowerPC C ABI fixes #64259

Open
wants to merge 2 commits into
base: master
from

Conversation

@smaeul
Copy link
Contributor

commented Sep 7, 2019

These patches fix some longstanding issues with the PowerPC C ABI that were causing several test failures. With these patches, I get a clean testsuite run on powerpc-unknown-linux-musl.

The PowerPC SVR4 ELF psABI specifies that, for parameter passing:

A struct, union, or long double, any of which shall be treated as
a pointer to the object, or to a copy of the object where necessary to
enforce call-by-value semantics. Only if the caller can ascertain that the
object is "constant" can it pass a pointer to the object itself.

The first commit fixes this for most aggregates; the second commit fixes this for zero-size aggregates.

smaeul added 2 commits Sep 5, 2019
Fix C aggregate-passing ABI on powerpc
The existing code (which looks like it was copied from MIPS) passes
aggregates by value in registers. This is wrong. According to the SVR4
powerpc psABI, all aggregates are passed indirectly.
Fix zero-sized aggregate ABI on powerpc
For targets that pass zero-sized aggregates indirectly (generally
those that pass all aggregates indirectly), we must allocate a register
for passing the address of the ZST. Clean up the existing cases and add
powerpc, which requires this as well.

While there are not currently musl targets for s390x or sparc64, they
would have the same ABI as gnu targets, so remove the env == "gnu" check
in the Linux case.

Ideally, since it is a property of the C ABI, the `!rust_abi` case would
be handled entirely in `adjust_c_abi`. However, that would require
updating each implementation of `compute_abi_info` to handle ZSTs.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Sep 7, 2019

r? @matthewjasper

(rust_highfive has picked a reviewer for you, use r? to override)

@matthewjasper

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2019

r? @nagisa

@rust-highfive rust-highfive assigned nagisa and unassigned matthewjasper Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.