mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Limit per-SDK swiftmodule restriction to tagged compilers
Only production compilers should apply the per-SDK restriction on loading swiftmodules. Use the "is the compiler tagged" information over a release build to align with the other main swiftmodule loading restriction accepting only swiftmodules built by the same tag. Also use an env var SWIFT_DEBUG_FORCE_SWIFTMODULE_PER_SDK to enable testing this feature in any compilers.
This commit is contained in:
@@ -309,6 +309,15 @@ static ValidationInfo validateControlBlock(
|
||||
case control_block::SDK_NAME: {
|
||||
result.sdkName = blobData;
|
||||
|
||||
// Enable this check for tagged compiler or when the
|
||||
// env var is set (for testing).
|
||||
static const char* forceDebugPreSDKRestriction =
|
||||
::getenv("SWIFT_DEBUG_FORCE_SWIFTMODULE_PER_SDK");
|
||||
if (version::Version::getCurrentCompilerVersion().empty() &&
|
||||
!forceDebugPreSDKRestriction) {
|
||||
break;
|
||||
}
|
||||
|
||||
// The loaded module was built with a compatible SDK if either:
|
||||
// * it was the same SDK
|
||||
// * or one who's name is a prefix of the clients' SDK name. This expects
|
||||
|
||||
Reference in New Issue
Block a user