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

Support small methods and selector indirection #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neuralmer
Copy link

Most of the entsize field is reserved for flags, see the definition of method_list_t in https://opensource.apple.com/source/objc4/objc4-787.1/runtime/objc-runtime-new.h

If the methods are marked as "small methods", the pointers for name, type, and imp are signed 32-bit relative addresses. The addresses are relative to the location where the addresses are stored in memory, which translates to being relative to the location in the binary image.

Some of the pointers point into __objc_selrefs, which appears to be an additional layer of indirection. I have not observed an __objc_selrefs section that was 32-bit aligned or in a 32-bit binary, but I have added a conditional in the case that it is encountered.

I tested this change on a library that used to cause the crash listed in issue #100, and it appears to work with these changes (after changing PLATFORM_IOSMAC to PLATFORM_MACCATALYST to be able to build with Xcode 12). This fix is merged from work I did on https://github.com/preemptive/PPiOS-Rename.

@malhal
Copy link

malhal commented Oct 31, 2020

Thanks for fixing this, I've been struggling for months without a working class-dump for iOS 14 and my attempts at hacking it failed. Once I merged this into my fork I'm up and running again so thanks a lot for figuring it out.

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.

2 participants