Skip to content

[Protocol Metadata] Create protocol metadata using WeakAnyLinkage to avoid duplication #39944

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
merged 1 commit into from Nov 30, 2021

Conversation

ghost
Copy link

@ghost ghost commented Oct 28, 2021

I've noticed that some SWIFT binaries show duplicate metadata entries such as __PROTOCOL_NSObject along with all descending linked metadata.
The Issue is that the protocol global is created with internal linkage. Because of the internal linkage, the linker will not merge identical records in the final output.
The fix is to update the linkage type to WeakAnyLinkage, same as in ObjC.

Also, from review feedback, we also match the visibility with ObjC visibility(GlobalValue::HiddenVisibility);

Resolves SR-15376.

@gmittert
Copy link
Contributor

@swift-ci please smoke test

@gmittert gmittert requested a review from jckarter October 29, 2021 17:41
@aschwaighofer
Copy link
Contributor

I think we also should match the visibility by setting it to hidden.

  GV->setVisibility(GlobalValue::HiddenVisibility);

https://github.com/llvm/llvm-project/blob/1c2d3338eb8a280fc49eef143f502c5f44f72e4c/clang/lib/CodeGen/CGObjCMac.cpp#L7074

@aschwaighofer
Copy link
Contributor

@swift-ci Please smoke test

@gmittert
Copy link
Contributor

gmittert commented Nov 3, 2021

@swift-ci please smoke test linux

@CodaFi
Copy link
Contributor

CodaFi commented Nov 5, 2021

@swift-ci test Linux platform

@aschwaighofer
Copy link
Contributor

@swift-ci Please test macOS

@swift-ci
Copy link
Contributor

swift-ci commented Nov 5, 2021

Build failed
Swift Test OS X Platform
Git Sha - 11eb5abb5f0822fe4381ca8e74342e38651bd602

@CodaFi
Copy link
Contributor

CodaFi commented Nov 6, 2021

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented Nov 6, 2021

Build failed
Swift Test OS X Platform
Git Sha - 2938d21c348d4c550acae03f4fcf46629675ee23

@dcci dcci self-requested a review November 8, 2021 03:52
@gmittert
Copy link
Contributor

@swift-ci please smoke test

@aschwaighofer
Copy link
Contributor

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 9c6029dcc8a4cb401c21ba3fba200c4c2f6641ac

@gmittert
Copy link
Contributor

@swift-ci please smoke test

@aschwaighofer
Copy link
Contributor

@swift-ci Please test

@aschwaighofer aschwaighofer merged commit 7c4ad9b into swiftlang:main Nov 30, 2021
aschwaighofer added a commit to aschwaighofer/swift that referenced this pull request Dec 2, 2021
…c metadata

This extends swiftlang#39944 to apply to more objc metadata.

rdar://85037490
aschwaighofer added a commit to aschwaighofer/swift that referenced this pull request Dec 10, 2021
…c metadata

This extends swiftlang#39944 to apply to more objc metadata.

rdar://85037490
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.

5 participants