diff options
| author | Ralf Jung <post@ralfj.de> | 2021-05-05 17:52:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-05 17:52:25 +0200 |
| commit | b2bb6876e0053afcfac2e1d179897191559675de (patch) | |
| tree | 5d629231758d5a076ef233d73f78b797c90180f3 | |
| parent | 9ffba0917bc87554087878b590b81c57600d83d0 (diff) | |
| parent | f9eda61569ded483fae2667e725ed89bcc2a1d71 (diff) | |
| download | rust-b2bb6876e0053afcfac2e1d179897191559675de.tar.gz rust-b2bb6876e0053afcfac2e1d179897191559675de.zip | |
Rollup merge of #84865 - petrochenkov:llthread, r=Mark-Simulacrum
rustbuild: Pass a `threads` flag that works to windows-gnu lld MinGW driver for COFF LLD doesn't currently translate GNU-style `--threads=N` to native `/threads:N`, so we have to pass the option in its native form to avoid an error. Also pass the `threads` flag to lld-link (windows-msvc lld) as well.
| -rw-r--r-- | src/bootstrap/test.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index de9c1882c7d..db443756de3 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1110,6 +1110,19 @@ struct Compiletest { compare_mode: Option<&'static str>, } +impl Compiletest { + fn add_lld_flags(builder: &Builder<'_>, target: TargetSelection, flags: &mut Vec<String>) { + if builder.config.use_lld { + if builder.is_fuse_ld_lld(target) { + flags.push("-Clink-arg=-fuse-ld=lld".to_string()); + } + + let threads = if target.contains("windows") { "/threads:1" } else { "--threads=1" }; + flags.push(format!("-Clink-arg=-Wl,{}", threads)); + } + } +} + impl Step for Compiletest { type Output = (); @@ -1250,18 +1263,12 @@ note: if you're sure you want to do this, please open an issue as to why. In the let mut hostflags = flags.clone(); hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display())); - if builder.is_fuse_ld_lld(compiler.host) { - hostflags.push("-Clink-args=-fuse-ld=lld".to_string()); - hostflags.push("-Clink-arg=-Wl,--threads=1".to_string()); - } + Self::add_lld_flags(builder, compiler.host, &mut hostflags); cmd.arg("--host-rustcflags").arg(hostflags.join(" ")); let mut targetflags = flags; targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display())); - if builder.is_fuse_ld_lld(target) { - targetflags.push("-Clink-args=-fuse-ld=lld".to_string()); - targetflags.push("-Clink-arg=-Wl,--threads=1".to_string()); - } + Self::add_lld_flags(builder, target, &mut targetflags); cmd.arg("--target-rustcflags").arg(targetflags.join(" ")); cmd.arg("--docck-python").arg(builder.python()); |
