Skip to content
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

Fix swift 5.4 linux compatibility #93

Merged

Conversation

Supereg
Copy link
Contributor

@Supereg Supereg commented Jun 30, 2021

As described in #92, swift 5.4 change the ClassMetadataLayout for platforms that do not support Objective-C interoperability. This resulted in Runtime crashing when running on those platforms with the newest swift releases.

This PR fixes this issue by adjusting the ClassMetadataLayout on those platforms.
I'm using the #if !swift(>=5.4) || canImport(Darwin). Not entirely sure if canImport(Darwin) is the proper check for availability of Objective-C interoperability (works though). Happy for any feedback.

I have another PR ready which adds some CI integration with GitHub to test the framework on all the available linux distortions. This PR passes all tests on all platforms: Actions Run.
I chose to do the CI PR separately so this fix can get merged faster.

With the release of swift 5.4 the ClassMetadataLayout was changed to not include
fields used for Objective-C interoperability on platforms which do not support it.

See apple/swift@38fc849#diff-22fb9f1513d9c05f34d493826b4553bba65a4336a41ae4413678feec549db3a5
@helje5
Copy link
Contributor

helje5 commented Jun 30, 2021

canImport(ObjectiveC) maybe?

@Supereg
Copy link
Contributor Author

Supereg commented Jun 30, 2021

With canImport(ObjectiveC) tests pass as well (see https://github.com/Supereg/Runtime/actions/runs/987505669).

The docs read like that package is only available if the objective-c runtime is available. So that is probably then the way to go.

@helje5
Copy link
Contributor

helje5 commented Jun 30, 2021

There are about 5 or 6 ObjC runtimes supported by clang, but I think only the Apple one is supported by Swift (and coming w/ a modmap). So I'm not entirely sure which one is better :-)

@Supereg
Copy link
Contributor Author

Supereg commented Jul 13, 2021

If I may ping you @wickwirew, would love to get a review on this to get the fix upstream (as well as my other PRs).

@wickwirew wickwirew merged commit a6cdf9e into wickwirew:master Jul 16, 2021
@Supereg Supereg deleted the fix/linux-swift5.4-class-metadata-layout branch January 10, 2024 20:54
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.

None yet

3 participants