Skip to content

Commit 73e6d2a

Browse files
committed
Execution: special case the first two arguments in RSP mode
The second argument is often treated specially as a mode specifier for tools. This is particularly important for Windows where `-lib` or `/lib` passed to `link` or `ld.lld-link` will change the linker to the librarian. This argument may not be sunk into the response file as it is not treated as the mode specifier then. Special case the first two arguments to ensure that the mode switch parameter is always passed for any tools.
1 parent 5fae1fd commit 73e6d2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/SwiftDriver/Execution/ArgsResolver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ public final class ArgsResolver {
216216
// Wrap all arguments in double quotes to ensure that both Unix and
217217
// Windows tools understand the response file.
218218
try fileSystem.writeFileContents(absPath) {
219-
$0.send(resolvedArguments[1...].map { quote($0) }.joined(separator: "\n"))
219+
$0.send(resolvedArguments[2...].map { quote($0) }.joined(separator: "\n"))
220220
}
221-
resolvedArguments = [resolvedArguments[0], "@\(absPath.pathString)"]
221+
resolvedArguments = [resolvedArguments[0], resolvedArguments[1], "@\(absPath.pathString)"]
222222
}
223223

224224
return true

0 commit comments

Comments
 (0)