Skip to content

Package CMO: Prevent serializing types from SDK/system modules imported as @_implementationOnly. #79140

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
Feb 6, 2025

Conversation

elsh
Copy link
Contributor

@elsh elsh commented Feb 4, 2025

Currently, types from @_implementationOnly modules can be serialized into client modules if their
defining modules are SDK or system modules. However, @_implementationOnly is intended to hide
types from external clients, and may cause the type’s metadata (e.g., field offsets) to be stripped. If
such types are serialized and later accessed by a client module, it can lead to linker errors due to the
missing metadata. This PR prevents all types imported with @_implementationOnly from being serialized.

Resolves rdar://144181455

@elsh elsh requested a review from eeckstein as a code owner February 4, 2025 22:26
@elsh
Copy link
Contributor Author

elsh commented Feb 4, 2025

@swift-ci smoke test

@elsh elsh force-pushed the elsh/pcmo-implOnly branch from 7c31f05 to 1e2a257 Compare February 5, 2025 14:19
@elsh
Copy link
Contributor Author

elsh commented Feb 5, 2025

@swift-ci smoke test

…ed as @_implementationOnly.

Currently, types from @_implementationOnly modules can be serialized into client modules if their
defining modules are SDK or system modules.

However, @_implementationOnly is intended to hide types from external clients, and may cause
the type’s metadata (e.g., field offsets) to be stripped. If such types are serialized and later
accessed by a client module, it can lead to linker errors due to the missing metadata.

This PR prevents all types imported with @_implementationOnly from being serialized.

Resolves rdar://144181455
@elsh elsh force-pushed the elsh/pcmo-implOnly branch from 1e2a257 to cb0720b Compare February 5, 2025 19:01
@elsh
Copy link
Contributor Author

elsh commented Feb 5, 2025

@swift-ci smoke test

@elsh elsh merged commit 0e1a03a into main Feb 6, 2025
3 checks passed
@elsh elsh deleted the elsh/pcmo-implOnly branch February 6, 2025 00:10
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.

2 participants