[5.7][Serialization] Soft-reject swiftmodules built against a different SDK on tagged compilers #58988
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rework how the compiler handles swiftmodules built against a different SDK. Instead of raising an error this makes the compiler soft-reject the swiftmodule and silently rebuild from the swiftinterface (as it does with outdated modules). We still get the hard errors for modules with no swiftinterfaces as we can't rebuild them.
Also limit this check to tagged compilers only. This allows dev compilers to be more versatile for testing and production compilers to be more reliable once deployed.
rdar://93257769
When restricting loading swiftmodules to the SDK used to build them, an exception should be made for modules built against an SDK that is a subset of the SDK used when loading the module. For example, a module built with the
macOS11
SDK should be loadable by a client targeting themacOS11.secret
SDK. In such a case, the swiftmodule file is more likely to be reliable.Loosening this check should make it easier to land it. However, this is still not a recommended configuration so we might want to remove this accepted use case in the future and bring back the requirement for an exact SDK name match.
rdar://92827584
Note that in practice, this feature is still turned off by default on the driver side behind the
ENABLE_RESTRICT_SWIFTMODULE_SDK
env var.Cherry-pick of #58935 and #58702. Includes #58987 to avoid merge-conflicts.