Skip to content

[6.1][Package CMO] Prevent serializing types from SDK/system modules imported as @_implementationOnly. #79173

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

Conversation

elsh
Copy link
Contributor

@elsh elsh commented Feb 5, 2025

  • Explanation: Types from @_implementationOnly imported modules were serialized if originating from SDK or system modules in the context of Package CMO; their metadata can get stripped since the types are intended to be hidden, leading to a linker error. This PR fixes it by filtering out all types imported as @_implementationOnly.
  • Scope: Modules importing a module with Package CMO enabled.
  • Original PR: Package CMO: Prevent serializing types from SDK/system modules imported as @_implementationOnly. #79140
  • Reviewer: @nkcsgexi
  • Issue: rdar://144181455
  • Risk: Low. Fixes linker error in the Package CMO context.
  • Testing: Added tests.

@elsh elsh requested a review from a team as a code owner February 5, 2025 22:45
@elsh
Copy link
Contributor Author

elsh commented Feb 5, 2025

@swift-ci test

@elsh elsh added the 🍒 release cherry pick Flag: Release branch cherry picks label Feb 5, 2025
@elsh elsh requested a review from nkcsgexi February 5, 2025 22:46
Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with Ellie offline about what this change entails, we need this as a follow-up fix for the previously merge PR #79063.

@elsh elsh force-pushed the elsh/rel/pcmo-implOnly branch from 8217d03 to 186e03c Compare February 6, 2025 02:54
@elsh
Copy link
Contributor Author

elsh commented Feb 6, 2025

@swift-ci test

@elsh elsh enabled auto-merge February 6, 2025 02:55
@elsh elsh force-pushed the elsh/rel/pcmo-implOnly branch from 186e03c to f053845 Compare February 6, 2025 10:08
@elsh
Copy link
Contributor Author

elsh commented Feb 6, 2025

@swift-ci test

…imported 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/rel/pcmo-implOnly branch from f053845 to 75d8bab Compare February 6, 2025 23:36
@elsh
Copy link
Contributor Author

elsh commented Feb 6, 2025

@swift-ci test

@elsh
Copy link
Contributor Author

elsh commented Feb 7, 2025

@swift-ci test macOS

@elsh elsh merged commit c710b6d into release/6.1 Feb 7, 2025
5 checks passed
@elsh elsh deleted the elsh/rel/pcmo-implOnly branch February 7, 2025 16:57
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.

2 participants