From 52192f814f2a4424d59a466bbc0d1cfc70a12da0 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 17 Nov 2025 16:58:44 -0800 Subject: [PATCH] SwiftDriver: explicitly select RSP handling on Windows When cross-compiling from Windows to Android, if we spill past the command line limit, we would need to emit a response file. The response file is emitted into the style of the build rather than the host. This means that on Unix platforms, we need to indicate that the response file is Windows not Unix. We rely on the internal behaviour of the second flag being special cased and emit the `--rsp-quoting=windows` parameter in the second argument position to ensure that it is passed on the command line (as if the argument is pushed into the response file, it will not be possible to honour it for processing the file). --- .../SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift b/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift index fa2bd8132..ae074b1c3 100644 --- a/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift +++ b/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift @@ -44,6 +44,10 @@ extension GenericUnixToolchain { sanitizers: Set, targetInfo: FrontendTargetInfo ) throws -> ResolvedTool { +#if os(Windows) + commandLine.appendFlag("--rsp-quoting=windows") +#endif + let targetTriple = targetInfo.target.triple switch linkerOutputType { case .dynamicLibrary: