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

Add arm64 support #47

Closed
wants to merge 1 commit into from
Closed

Conversation

jasongregori
Copy link

Arm64 and x86_64 support for the iPhone 5s and the 64bit simulator.

forwarderImp = class_getMethodImplementation_stret(subclass, @selector(aMethodThatMustNotExist));
#else
forwarderImp = class_getMethodImplementation(subclass, @selector(aMethodThatMustNotExist));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure why I have to do this but I believe it is because the arm64 version of objc can use the same functions for struct returning functions. Here is a little evidence: https://twitter.com/gparker/status/378082112684843008

Not sure if there is a better #ifdef that I could do instead of __arm64__

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting... I thought I saw in the ABI that arm64 structs over 8 bytes would need the stret (for regular arm it was 4 bytes), but maybe Apple is doing something different. I don't see how it's avoidable for large structs at some point, but maybe there is information in registers which one function can determine the difference at runtime, or something like that. Although, if class_getMethodImplementation_stret() returned a non-NULL function which was different, that means the objc_msgForward_stret function (or something like it) exists in the arm64 runtime, so it might be necessary at some point. Anyways, it would be best to put the #ifdef check in the implementation of the usesSpecialStructureReturn method to just return NO (if that is indeed the correct implementation).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, it does appear that all the *stret() functions do not exist in the arm64 runtime. So, you can't even reference them, and you need to conditionally compile them.

I updated my pull request #44 to have this basic fix (since it already re-organized the code which called it).

@erikdoe
Copy link
Owner

erikdoe commented Nov 12, 2013

I've just merged Carl's pull request #44, which contains the required changes for arm64.

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

Successfully merging this pull request may close these issues.

3 participants