about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-08-07 15:59:37 +0200
committerGitHub <noreply@github.com>2024-08-07 15:59:37 +0200
commita05f187b156f8002b13f4d60665403d2d1fba8b2 (patch)
treef59e08e4c8ccd393c268127f5f1efa413bb8a50c
parent493233ce290e32fe6cc4aa08099014def6fd8388 (diff)
parent1737845cb41c3eefe5318fd6bb8db4dbabe03f69 (diff)
downloadrust-a05f187b156f8002b13f4d60665403d2d1fba8b2.tar.gz
rust-a05f187b156f8002b13f4d60665403d2d1fba8b2.zip
Rollup merge of #128656 - ChrisDenton:rust-lld, r=lqd
Enable msvc for run-make/rust-lld

This is simply a matter of using the right argument for lld-link.

As a bonus, I also fixed a typo.

try-job: i686-msvc
try-job: x86_64-msvc
-rw-r--r--tests/run-make/rust-lld/rmake.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/run-make/rust-lld/rmake.rs b/tests/run-make/rust-lld/rmake.rs
index 87477c12230..d0bc19130d7 100644
--- a/tests/run-make/rust-lld/rmake.rs
+++ b/tests/run-make/rust-lld/rmake.rs
@@ -2,15 +2,17 @@
 // see https://github.com/rust-lang/compiler-team/issues/510 for more info
 
 //@ needs-rust-lld
-//@ ignore-msvc
 //@ ignore-s390x lld does not yet support s390x as target
 
 use std::process::Output;
 
 use run_make_support::regex::Regex;
-use run_make_support::rustc;
+use run_make_support::{is_msvc, rustc};
 
 fn main() {
+    // lld-link is used if msvc, otherwise a gnu-compatible lld is used.
+    let linker_version_flag = if is_msvc() { "--version" } else { "-Wl,-v" };
+
     // Opt-in to lld and the self-contained linker, to link with rust-lld. We'll check that by
     // asking the linker to display its version number with a link-arg.
     let output = rustc()
@@ -18,7 +20,7 @@ fn main() {
         .arg("-Zlinker-features=+lld")
         .arg("-Clink-self-contained=+linker")
         .arg("-Zunstable-options")
-        .link_arg("-Wl,-v")
+        .link_arg(linker_version_flag)
         .input("main.rs")
         .run();
     assert!(
@@ -27,10 +29,10 @@ fn main() {
         output.stderr_utf8()
     );
 
-    // It should not be used when we explictly opt-out of lld.
+    // It should not be used when we explicitly opt-out of lld.
     let output = rustc()
         .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
-        .link_arg("-Wl,-v")
+        .link_arg(linker_version_flag)
         .arg("-Zlinker-features=-lld")
         .input("main.rs")
         .run();
@@ -44,7 +46,7 @@ fn main() {
     // times to rustc.
     let output = rustc()
         .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info")
-        .link_arg("-Wl,-v")
+        .link_arg(linker_version_flag)
         .arg("-Clink-self-contained=+linker")
         .arg("-Zunstable-options")
         .arg("-Zlinker-features=-lld")