diff --git a/Sources/SwiftDriver/Jobs/LinkJob.swift b/Sources/SwiftDriver/Jobs/LinkJob.swift index 76668127e..fa7d40eb5 100644 --- a/Sources/SwiftDriver/Jobs/LinkJob.swift +++ b/Sources/SwiftDriver/Jobs/LinkJob.swift @@ -49,15 +49,6 @@ extension Driver { mutating func linkJob(inputs: [TypedVirtualPath]) throws -> Job { var commandLine: [Job.ArgTemplate] = [] - #if os(Windows) - // We invoke clang as `clang.exe`, which expects a POSIX-style response file by default (`clang-cl.exe` expects - // Windows-style response files). - // The driver is outputting Windows-style response files because swift-frontend expects Windows-style response - // files. - // Force `clang.exe` into parsing Windows-style response files. - commandLine.appendFlag("--rsp-quoting=windows") - #endif - // Compute the final output file let outputFile: VirtualPath if let output = parsedOptions.getLastArgument(.o) { diff --git a/Sources/SwiftDriver/Jobs/WindowsToolchain+LinkerSupport.swift b/Sources/SwiftDriver/Jobs/WindowsToolchain+LinkerSupport.swift index 1bbb745ad..85c34fd17 100644 --- a/Sources/SwiftDriver/Jobs/WindowsToolchain+LinkerSupport.swift +++ b/Sources/SwiftDriver/Jobs/WindowsToolchain+LinkerSupport.swift @@ -94,6 +94,13 @@ extension WindowsToolchain { let clangTool: Tool = cxxCompatEnabled ? .clangxx : .clang var clang = try getToolPath(clangTool) + // We invoke clang as `clang.exe`, which expects a POSIX-style response file by default (`clang-cl.exe` expects + // Windows-style response files). + // The driver is outputting Windows-style response files because swift-frontend expects Windows-style response + // files. + // Force `clang.exe` into parsing Windows-style response files. + commandLine.appendFlag("--rsp-quoting=windows") + let targetTriple = targetInfo.target.triple if !targetTriple.triple.isEmpty { commandLine.appendFlag("-target")