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

Update psABI to match Itanium C++ ABI fixes for passing class objects indirectly #6

Open
zygoloid opened this issue Oct 28, 2017 · 4 comments

Comments

@zygoloid
Copy link
Contributor

The Itanium C++ ABI was recently fixed to properly determine whether to pass objects of class type in registers in C++11 onwards, taking move constructors into account:

itanium-cxx-abi/cxx-abi@05fc233

Section 3.2.3 of the x86 psABI should be updated to take this into account. Or better, it should simply defer to the Itanium C++ ABI to determine how to pass C++ classes rather than trying to duplicate the specification.

Eg, something like:

If a C++ object has either a non-trivial copy constructor or a non-trivial destructor [Footnote] is non-trivial for the purpose of calls, as specified in the Itanium C++ ABI, it is passed by invisible reference (the object is replaced in the parameter list by a pointer that has class INTEGER)

@hjl-tools
Copy link
Owner

Does this patch look OK?

0001-Refer-non-trivial-C-object-to-C-ABI.patch.txt

@hjl-tools hjl-tools reopened this Oct 30, 2017
@zygoloid
Copy link
Contributor Author

Yes, thanks, that patch looks good.

I wonder if we should also update footnote 14: "An object with either a non-trivial copy constructor or a non-trivial destructor cannot be passed by value because such objects must have well defined addresses. Similar issues apply when returning an object from a function."

Perhaps something like: "An object whose type is non-trivial for the purpose of calls cannot be passed by value because such objects must have the same address in the caller and the callee. Similar issues apply when returning an object from a function. See C++17 [class.temporary] paragraph 3."

@hjl-tools
Copy link
Owner

Would you mind send me a patch?

@zygoloid
Copy link
Contributor Author

Here: #7

zygoloid added a commit to zygoloid/x86-psABI that referenced this issue Oct 31, 2017
indirectly when they have non-trivial or deleted move constructors, or
deleted copy constructors or destructors.

Fixes hjl-tools#6.
hjl-tools pushed a commit that referenced this issue Nov 14, 2017
indirectly when they have non-trivial or deleted move constructors, or
deleted copy constructors or destructors.

Fixes #6.
hjl-tools pushed a commit that referenced this issue Feb 1, 2018
indirectly when they have non-trivial or deleted move constructors, or
deleted copy constructors or destructors.

Fixes #6.
hjl-tools pushed a commit that referenced this issue Aug 7, 2018
… indirectly when they have non-trivial or deleted move constructors, or deleted copy constructors or destructors.

Fixes #6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants