[4.2] [runtime] Backwards-deployment support for class_getImageName #18076
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.
Explanation: Follow-up to [4.2] Override ObjC's class_getImageName to handle Swift classes #17930. The hook for adding capabilities to
class_getImageName
is only present on new builds of the 2018 Apple OSs. That means we need a different answer on older OSs, and the best one we came up with (mostly @gparker42) is to overwrite symbol tables directly, to substitute in our implementation ofclass_getImageName
.Scope: Sets up the new dyld image loading hook on all OSs that don't have the new
objc_setHook_getImageName
. Also undoes the change to link arclite more often, since the feature we thought we'd need there is now just in the Swift runtime itself.Issue: SR-1917, rdar://problem/41535552
Risk: Medium. Patching symbol tables like this is a brazen idea, but it means that if we got something wrong we'd likely know about it immediately. The actual patched-in code is pretty straightforward.
Testing: Ran previously-added tests on iPhone, macOS, and iOS simulator environments with older OSs, verifying that the formerly XFAILing parts are now passisng.
Reviewed by: @mikeash, patching parts also reviewed by me (originally by @gparker42)