-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IRGen] Don't emit relative references to Objective-C class references. #21107
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
Merged
DougGregor
merged 3 commits into
swiftlang:master
from
DougGregor:relative-objc-class-by-name
Dec 7, 2018
Merged
[IRGen] Don't emit relative references to Objective-C class references. #21107
DougGregor
merged 3 commits into
swiftlang:master
from
DougGregor:relative-objc-class-by-name
Dec 7, 2018
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Objective-C class references (which show up in the __objc_classrefs section) are always coalesced by the linker. When we relatively address them (which occurs in protocol conformance records), the linker may compute the relative offset *before* coalescing, leading to an incorrect result. The net effect is a protocol conformance record that applies to the wrong Objective-C class, causing all sorts of runtime mayhem. Switch relatively-addressed Objective-C classes over to using the Objective-C runtime name of the class. It's a less efficient encoding (since we need to go through objc_lookUpClass), but it avoids the linker bug. Fixes rdar://problem/46428085 by working around the linker bug.
Now that we're never relatively addressing an Objective-C class reference, stop emitting them as file-local (by eliminating the \01l_ prefix). This is both a minor optimization and also a way to ensure that things will break more consistently if a problem remains.
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
@swift-ci please smoke test Linux |
Build failed |
Build failed |
DougGregor
added a commit
to DougGregor/swift
that referenced
this pull request
Dec 10, 2018
This test appears to have been fixed by swiftlang#21107. Fixes rdar://problem/42789939.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective-C class references (which show up in the __objc_classrefs
section) are always coalesced by the linker. When we relatively
address them (which occurs in protocol conformance records), the
linker may compute the relative offset before coalescing, leading to
an incorrect result. The net effect is a protocol conformance record
that applies to the wrong Objective-C class, causing all sorts of
runtime mayhem.
Switch relatively-addressed Objective-C classes over to using the
Objective-C runtime name of the class. It's a less efficient encoding
(since we need to go through objc_lookUpClass), but it avoids the
linker bug.
Fixes rdar://problem/46428085 by working around the linker bug.