1
Fork 0

Rollup merge of #137676 - petrochenkov:winresp, r=Kobzol

linker: Fix escaping style for response files on Windows

If we use a С/С++ compiler as linker, then Posix-style escaping should be used.

Also temporarily fixup rustbuild to not fail at least in common scenarios, until the bootstrap compiler is updated.

Fixes https://github.com/rust-lang/rust/issues/137498
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2025-02-28 22:29:54 +08:00 committed by GitHub
commit f1cdd3be01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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(),
);