Skip to content

Commit 6817849

Browse files
committed
Pass down SDK name to the compiler by default
The compiler uses the -target-sdk-name flag information to restrict which swiftmodules can be loaded and which should be ignored. This prevents preventable crash when swiftmodules are copied between mismatching SDKs. rdar://83104265
1 parent c771555 commit 6817849

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

Sources/SwiftDriver/Toolchains/DarwinToolchain.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,7 @@ public final class DarwinToolchain: Toolchain {
377377
commandLine.append(.flag(sdkInfo.sdkVersion(for: targetVariantTriple).sdkVersionString))
378378
}
379379

380-
if driver.isFrontendArgSupported(.targetSdkName) &&
381-
env["ENABLE_RESTRICT_SWIFTMODULE_SDK"] != nil {
380+
if driver.isFrontendArgSupported(.targetSdkName) {
382381
commandLine.append(.flag(Option.targetSdkName.spelling))
383382
commandLine.append(.flag(sdkInfo.canonicalName))
384383
}

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3931,7 +3931,6 @@ final class SwiftDriverTests: XCTestCase {
39313931
// Test cases ported from Driver/macabi-environment.swift
39323932
func testDarwinSDKVersioning() throws {
39333933
var envVars = ProcessEnv.vars
3934-
envVars["ENABLE_RESTRICT_SWIFTMODULE_SDK"] = "YES"
39353934
envVars["SWIFT_DRIVER_LD_EXEC"] = ld.nativePathString(escaped: false)
39363935

39373936
try withTemporaryDirectory { tmpDir in

0 commit comments

Comments
 (0)