Skip to content

[4.2] [runtime] Backwards-deployment support for class_getImageName #18076

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

Conversation

jrose-apple
Copy link
Contributor

  • 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 of class_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)

…ss_getImageName

[runtime] Backwards-deployment support for class_getImageName

https://bugs.swift.org/browse/SR-1917
rdar://problem/41535552
(cherry picked from commit 6f42fcc)
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please nominate

@jrose-apple jrose-apple merged commit 9277281 into swiftlang:swift-4.2-branch Jul 19, 2018
@jrose-apple jrose-apple deleted the 4.2-and-you-get-a-class_getImageName branch July 19, 2018 18:32
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.

1 participant