Skip to content

Fix linkage for Linux and BSD symbol declarations that use CF_PRIVATE #1740

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 2 commits into from
Oct 30, 2018
Merged

Fix linkage for Linux and BSD symbol declarations that use CF_PRIVATE #1740

merged 2 commits into from
Oct 30, 2018

Conversation

millenomi
Copy link
Contributor

Symbols using CF_PRIVATE are meant to be available outside the compilation unit where they're declared, but not outside Core Foundation. Headers that use CF_PRIVATE thus mean to declare, not define, these symbols. Match Darwin by adding extern to the CF_PRIVATE definition, and then add -fno-common to also match how Darwin compiles and detect double symbol definitions.

This fixes Linux crashes in CFString encoding introduced by the Mojave merge.

Symbols using `CF_PRIVATE` are meant to be available outside the compilation unit where they're declared, but not outside Core Foundation. Headers that use `CF_PRIVATE` thus mean to declare, not define, these symbols. Match Darwin by adding `extern` to the `CF_PRIVATE` definition, and then add `-fno-common` to also match how Darwin compiles and detect double symbol definitions.

This fixes Linux crashes in CFString encoding introduced by the Mojave merge.
@millenomi
Copy link
Contributor Author

@compnerd ping.

CMake flag addition incoming.

@millenomi
Copy link
Contributor Author

@swift-ci please test

@compnerd
Copy link
Member

LGTM, I do believe that this should fix the issue as the types were marked with CF_PRIVATE.

@millenomi
Copy link
Contributor Author

@swift-ci please test

@millenomi millenomi merged commit 95988ac into swiftlang:master Oct 30, 2018
@parkera
Copy link
Contributor

parkera commented Oct 31, 2018

Thank you @compnerd for your work on this!

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.

3 participants