-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[runtime] Backwards-deployment support for class_getImageName #18060
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
[runtime] Backwards-deployment support for class_getImageName #18060
Conversation
@swift-ci Please test |
Build failed |
c4f6f31
to
271cc0d
Compare
Full macOS tests here. I just failed to account for the new files getting compiled on Linux too. @swift-ci Please smoke test |
Follow-up to 3ed3774. On Apple OSs that don't have the new Objective-C runtime function 'objc_setHook_getImageName', override the system definition of 'class_getImageName' by literally rewriting symbol tables at run time. Yes, you read that correctly. The low-level part of this patch was written by Greg Parker, then simplified and tweaked by me to fit the Swift coding style. Don't try this at home; it comes with all sorts of caveats and won't actually work on this year's iOS. (Fortunately we don't need it there, because that will have the new ObjC entry point.) The rest of the patch is pretty straightforward: the replacement implementation calls the code that supports Swift objects (the same code we use on newer OSs), which then chains back to the original system implementation of class_getImageName. May we never have to touch this again. rdar://problem/41535552
Reverts the effects of df974b2, but keeps the refactoring and nicer tests.
271cc0d
to
e9f71fd
Compare
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve this message.
…ss_getImageName [runtime] Backwards-deployment support for class_getImageName https://bugs.swift.org/browse/SR-1917 rdar://problem/41535552 (cherry picked from commit 6f42fcc)
Merge pull request #18060 from jrose-apple/and-you-get-a-class_getImageName https://bugs.swift.org/browse/SR-1917 rdar://problem/41535552 (cherry picked from commit 6f42fcc)
Follow-up to #17910. On Apple OSs that don't have the new Objective-C runtime function
objc_setHook_getImageName
, override the system definition ofclass_getImageName
by literally rewriting symbol tables at run time.Yes, you read that correctly.
The low-level part of this patch was written by @gparker42, then simplified and tweaked by me to fit the Swift coding style. Don't try this at home; it comes with all sorts of caveats and won't actually work on this year's iOS. (Fortunately we don't need it there, because that will have the new ObjC entry point.)
The rest of the patch is pretty straightforward: the replacement implementation calls the code that supports Swift objects (the same code we use on newer OSs), which then chains back to the original system implementation of
class_getImageName
. May we never have to touch this again.SR-1917 / rdar://problem/41535552