Support small methods and selector indirection #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Most of the
entsize
field is reserved for flags, see the definition ofmethod_list_t
in https://opensource.apple.com/source/objc4/objc4-787.1/runtime/objc-runtime-new.hIf 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
toPLATFORM_MACCATALYST
to be able to build with Xcode 12). This fix is merged from work I did on https://github.com/preemptive/PPiOS-Rename.