Skip to content

[5.9] IRGen: Only use clang protocol emission on newer deployment targets #65555

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

aschwaighofer
Copy link
Contributor

@aschwaighofer aschwaighofer commented May 1, 2023

We started using clang to emit the OBJC_PROTOCOL definition.

But we would use a different name for the proto_list definition than clang.

"OBJC_LABEL_PROTOCOL$" (objc)
|--> OBJC_PROTOCOL
"\01l_OBJC_LABEL_PROTOCOL$_" (swift)
|--> OBJC_PROTOCOL

If an Objective C object also emitted the same protocol definition you could end up in a situation where both clang's and swift's proto_list definitions point to the same protocol definition.

Older linkers don't like that.

main PR: #65549

Risk: Should be quite low, were are restoring behavior that the compiler had pre 5.8 dependent on the deployment target

rdar://108505376

…gets

We started using clang to emit the _OBJC_PROTOCOL_ definition.

But we would use a different name for the proto_list definition than clang.

"OBJC_LABEL_PROTOCOL$" (objc)
|--> OBJC_PROTOCOL
"\01l_OBJC_LABEL_PROTOCOL$_" (swift)
|--> OBJC_PROTOCOL

If an Objective C object also emitted the same protocol definition you could
end up in a situation where both clang's and swift's proto_list definitions
point to the same protocol definition.

Older linkers don't like that.

rdar://108505376
@aschwaighofer aschwaighofer requested a review from a team as a code owner May 1, 2023 21:28
@aschwaighofer
Copy link
Contributor Author

@swift-ci test

@aschwaighofer aschwaighofer merged commit ba9c210 into swiftlang:release/5.9 May 2, 2023
@AnthonyLatsis AnthonyLatsis added the 🍒 release cherry pick Flag: Release branch cherry picks label May 3, 2023
@Ch111p
Copy link

Ch111p commented Oct 25, 2024

@aschwaighofer Hi Arnold! Sorry for bothering you. Could I ask what will happen if deployment target doesn't satisfied with getSwift58Availability()? Will it cause a runtime crash or..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants