         var driver = try Driver(args: ["swiftc", main.pathString,
                                        "-save-temps",
                                        "-driver-filelist-threshold", "0",
-                                       "-o", outputPath.pathString],
+                                       "-o", outputPath.pathString] + getHostToolchainSdkArg(executor),
                                 env: ProcessEnv.vars,
                                 diagnosticsEngine: diags,
                                 fileSystem: localFileSystem,

        var driver = try Driver(args: ["swiftc", main.pathString,
                                       "-driver-filelist-threshold", "0",
                                       "-Xfrontend", "-debug-crash-immediately",
                                       "-o", outputPath.pathString],
                                env: ProcessEnv.vars,
                                diagnosticsEngine: diags,
                                fileSystem: localFileSystem,

    }
  }

  private func getHostToolchainSdkArg(_ executor: SwiftDriverExecutor) throws -> [String] {
    #if os(macOS)
    let toolchain = DarwinToolchain(env: ProcessEnv.vars, executor: executor)
    return try ["-sdk", toolchain.sdk.get().pathString]
    #else
    return []
    #endif
  }

  func testSaveTemps() throws {
    do {
      try withTemporaryDirectory { path in
        let main = path.appending(component: "main.swift")
