Skip to content

Commit 549454f

Browse files
committed
Add post-dist test for checking that we use LLD
And remove the previous beta/stable/nightly LLD tests.
1 parent de39166 commit 549454f

File tree

7 files changed

+32
-22
lines changed

7 files changed

+32
-22
lines changed

src/tools/opt-dist/src/tests.rs

+3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ llvm-config = "{llvm_config}"
104104
"tests/incremental",
105105
"tests/mir-opt",
106106
"tests/pretty",
107+
// Make sure that we don't use too new GLIBC symbols on x64
107108
"tests/run-make/glibc-symbols-x86_64-unknown-linux-gnu",
109+
// Make sure that we use LLD by default on x64
110+
"tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist",
108111
"tests/ui",
109112
"tests/crashes",
110113
];

tests/run-make/rust-lld-by-default-beta-stable/main.rs

-1
This file was deleted.

tests/run-make/rust-lld-by-default-beta-stable/rmake.rs

-14
This file was deleted.

tests/run-make/rust-lld-by-default-nightly/rmake.rs renamed to tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist/rmake.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu` on the nightly
2-
// channel, and that it can also be turned off with a CLI flag.
1+
// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu`
2+
// dist artifacts and that it can also be turned off with a CLI flag.
33

4-
//@ needs-rust-lld
5-
//@ ignore-beta
6-
//@ ignore-stable
4+
//@ only-dist
75
//@ only-x86_64-unknown-linux-gnu
86

97
use run_make_support::linker::{assert_rustc_doesnt_use_lld, assert_rustc_uses_lld};
108
use run_make_support::rustc;
119

1210
fn main() {
13-
// A regular compilation should use rust-lld by default. We'll check that by asking the linker
14-
// to display its version number with a link-arg.
11+
// A regular compilation should use rust-lld by default.
1512
assert_rustc_uses_lld(rustc().input("main.rs"));
1613

1714
// But it can still be disabled by turning the linker feature off.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Test linking using `cc` with `rust-lld`, which is on by default on the x86_64-unknown-linux-gnu
2+
// target.
3+
// See https://github.com/rust-lang/compiler-team/issues/510 for more info
4+
5+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu`
2+
// and that it can also be turned off with a CLI flag.
3+
//
4+
// This version of the test checks that LLD is used by default when LLD is enabled in the
5+
// toolchain. There is a separate test that checks that LLD is used for dist artifacts
6+
// unconditionally.
7+
8+
//@ needs-rust-lld
9+
//@ only-x86_64-unknown-linux-gnu
10+
11+
use run_make_support::linker::{assert_rustc_doesnt_use_lld, assert_rustc_uses_lld};
12+
use run_make_support::rustc;
13+
14+
fn main() {
15+
// A regular compilation should use rust-lld by default.
16+
assert_rustc_uses_lld(rustc().input("main.rs"));
17+
18+
// But it can still be disabled by turning the linker feature off.
19+
assert_rustc_doesnt_use_lld(rustc().arg("-Zlinker-features=-lld").input("main.rs"));
20+
}

0 commit comments

Comments
 (0)