about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-02-28 22:29:54 +0800
committerGitHub <noreply@github.com>2025-02-28 22:29:54 +0800
commitf1cdd3be01cff388fce64bd9cbd413173b3910ae (patch)
treeaf4256e74f7268b638418978b0f48d009461c615 /compiler/rustc_codegen_ssa/src
parent4606610b2136cbaba4ab58658042c643044e3511 (diff)
parent9a2362a76eac403552fd93a0977e10731f3d9de3 (diff)
downloadrust-f1cdd3be01cff388fce64bd9cbd413173b3910ae.tar.gz
rust-f1cdd3be01cff388fce64bd9cbd413173b3910ae.zip
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
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/link.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index b090730ac6b..5054ae561c0 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -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(),
         );