1
Fork 0

linker: Fix escaping style for response files on Windows

If we use a С/С++ compiler as linker, then Posix-style escaping should be used.
This commit is contained in:
Vadim Petrochenkov 2025-02-26 16:24:39 +03:00
parent 2af87eab3b
commit 9a2362a76e
5 changed files with 37 additions and 13 deletions

View file

@ -1726,8 +1726,12 @@ fn exec_linker(
args.push_str(
&Escape {
arg: arg.to_str().unwrap(),
// LLD also uses MSVC-like parsing for @-files by default when running on windows hosts
is_like_msvc: sess.target.is_like_msvc || (cfg!(windows) && flavor.uses_lld()),
// Windows-style escaping for @-files is used by
// - all linkers targeting MSVC-like targets, including LLD
// - all LLD flavors running on Windows hosts
// С/С++ compilers use Posix-style escaping (except clang-cl, which we do not use).
is_like_msvc: sess.target.is_like_msvc
|| (cfg!(windows) && flavor.uses_lld() && !flavor.uses_cc()),
}
.to_string(),
);