Skip to content

Commit bc0e2c8

Browse files
committed
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).
1 parent 83f8460 commit bc0e2c8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ extension GenericUnixToolchain {
4444
sanitizers: Set<Sanitizer>,
4545
targetInfo: FrontendTargetInfo
4646
) throws -> ResolvedTool {
47+
#if os(Windows)
48+
commandLine.appendFlag("--rsp-quoting=windows")
49+
#endif
50+
4751
let targetTriple = targetInfo.target.triple
4852
switch linkerOutputType {
4953
case .dynamicLibrary:

0 commit comments

Comments
 (0)