Skip to content

IRGen: Work around RemoteMirror bug generating reflection info for empty builtin types. #29037

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
Jan 7, 2020

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Jan 7, 2020

The RemoteMirror library in shipping versions of macOS/iOS/tvOS/watchOS crashes if the compiler
emits a BuiltinTypeDescriptor with size zero. Although this is fixed in top-of-tree RemoteMirror,
we want binaries built with the new compiler to still be inspectable when run on older OSes.
Generate the metadata as an empty struct with no fields when deploying back to these older
platforms, which should be functionally equivalent for most purposes.
Fixes rdar://problem/57924984.

…pty builtin types.

The RemoteMirror library in shipping versions of macOS/iOS/tvOS/watchOS crashes if the compiler
emits a BuiltinTypeDescriptor with size zero. Although this is fixed in top-of-tree RemoteMirror,
we want binaries built with the new compiler to still be inspectable when run on older OSes.
Generate the metadata as an empty struct with no fields when deploying back to these older
platforms, which should be functionally equivalent for most purposes.
Fixes rdar://problem/57924984.
@jckarter
Copy link
Contributor Author

jckarter commented Jan 7, 2020

@swift-ci Please test

@mikeash
Copy link
Contributor

mikeash commented Jan 7, 2020

@tbkka


import EmptyStruct

@_alignment(1) struct EmptyStruct { }
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you declaring the alignment here?

Copy link
Contributor Author

@jckarter jckarter Jan 7, 2020

Choose a reason for hiding this comment

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

The compiler always generates BuiltinTypeDescriptors for types with declared alignment (because the normal layout algorithm would mis-align them), so this is just to exercise that code path. An empty type should not be able to affect the layout of its enclosing aggregate regardless of its supposed alignment, so it should be OK to fall back to an empty struct layout.

@jckarter jckarter merged commit 6e7521a into master Jan 7, 2020
@jckarter jckarter deleted the zero-builtin-type-descriptor-workaround branch January 7, 2020 19:12
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