diff options
| author | Rémy Rakic <remy.rakic+github@gmail.com> | 2025-03-18 08:17:38 +0100 |
|---|---|---|
| committer | Rémy Rakic <remy.rakic+github@gmail.com> | 2025-07-08 08:08:40 +0000 |
| commit | aa527115432df082f3c9e4d2459acb7bb02ed5a6 (patch) | |
| tree | 12c97160ee600db6bc2b49b7d9292e8626dadb0e | |
| parent | a4ea949356b8d40e7c588cccf30739fbb22cd45c (diff) | |
| download | rust-aa527115432df082f3c9e4d2459acb7bb02ed5a6.tar.gz rust-aa527115432df082f3c9e4d2459acb7bb02ed5a6.zip | |
add post-dist test for checking that we use LLD
And remove the previous beta/stable/nightly LLD tests.
| -rw-r--r-- | src/tools/opt-dist/src/tests.rs | 3 | ||||
| -rw-r--r-- | tests/run-make/rust-lld-by-default-beta-stable/main.rs | 1 | ||||
| -rw-r--r-- | tests/run-make/rust-lld-by-default-beta-stable/rmake.rs | 14 | ||||
| -rw-r--r-- | tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist/main.rs (renamed from tests/run-make/rust-lld-by-default-nightly/main.rs) | 0 | ||||
| -rw-r--r-- | tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist/rmake.rs (renamed from tests/run-make/rust-lld-by-default-nightly/rmake.rs) | 11 | ||||
| -rw-r--r-- | tests/run-make/rust-lld-x86_64-unknown-linux-gnu/main.rs | 5 | ||||
| -rw-r--r-- | tests/run-make/rust-lld-x86_64-unknown-linux-gnu/rmake.rs | 20 |
7 files changed, 32 insertions, 22 deletions
diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs index 705a1750ae8..2d2aab86eda 100644 --- a/src/tools/opt-dist/src/tests.rs +++ b/src/tools/opt-dist/src/tests.rs @@ -106,7 +106,10 @@ llvm-config = "{llvm_config}" "tests/incremental", "tests/mir-opt", "tests/pretty", + // Make sure that we don't use too new GLIBC symbols on x64 "tests/run-make/glibc-symbols-x86_64-unknown-linux-gnu", + // Make sure that we use LLD by default on x64 + "tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist", "tests/ui", "tests/crashes", ]; diff --git a/tests/run-make/rust-lld-by-default-beta-stable/main.rs b/tests/run-make/rust-lld-by-default-beta-stable/main.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make/rust-lld-by-default-beta-stable/main.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs b/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs deleted file mode 100644 index 9a08991c4b8..00000000000 --- a/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Ensure that rust-lld is *not* used as the default linker on `x86_64-unknown-linux-gnu` on stable -// or beta. - -//@ ignore-nightly -//@ only-x86_64-unknown-linux-gnu - -use run_make_support::linker::assert_rustc_doesnt_use_lld; -use run_make_support::rustc; - -fn main() { - // A regular compilation should not use rust-lld by default. We'll check that by asking the - // linker to display its version number with a link-arg. - assert_rustc_doesnt_use_lld(rustc().input("main.rs")); -} diff --git a/tests/run-make/rust-lld-by-default-nightly/main.rs b/tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist/main.rs index e9f655fc09e..e9f655fc09e 100644 --- a/tests/run-make/rust-lld-by-default-nightly/main.rs +++ b/tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist/main.rs diff --git a/tests/run-make/rust-lld-by-default-nightly/rmake.rs b/tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist/rmake.rs index 3ff1e2770e6..c26f82b7d37 100644 --- a/tests/run-make/rust-lld-by-default-nightly/rmake.rs +++ b/tests/run-make/rust-lld-x86_64-unknown-linux-gnu-dist/rmake.rs @@ -1,17 +1,14 @@ -// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu` on the nightly -// channel, and that it can also be turned off with a CLI flag. +// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu` +// dist artifacts and that it can also be turned off with a CLI flag. -//@ needs-rust-lld -//@ ignore-beta -//@ ignore-stable +//@ only-dist //@ only-x86_64-unknown-linux-gnu use run_make_support::linker::{assert_rustc_doesnt_use_lld, assert_rustc_uses_lld}; use run_make_support::rustc; fn main() { - // A regular compilation should use rust-lld by default. We'll check that by asking the linker - // to display its version number with a link-arg. + // A regular compilation should use rust-lld by default. assert_rustc_uses_lld(rustc().input("main.rs")); // But it can still be disabled by turning the linker feature off. diff --git a/tests/run-make/rust-lld-x86_64-unknown-linux-gnu/main.rs b/tests/run-make/rust-lld-x86_64-unknown-linux-gnu/main.rs new file mode 100644 index 00000000000..e9f655fc09e --- /dev/null +++ b/tests/run-make/rust-lld-x86_64-unknown-linux-gnu/main.rs @@ -0,0 +1,5 @@ +// Test linking using `cc` with `rust-lld`, which is on by default on the x86_64-unknown-linux-gnu +// target. +// See https://github.com/rust-lang/compiler-team/issues/510 for more info + +fn main() {} diff --git a/tests/run-make/rust-lld-x86_64-unknown-linux-gnu/rmake.rs b/tests/run-make/rust-lld-x86_64-unknown-linux-gnu/rmake.rs new file mode 100644 index 00000000000..e71a47f11e2 --- /dev/null +++ b/tests/run-make/rust-lld-x86_64-unknown-linux-gnu/rmake.rs @@ -0,0 +1,20 @@ +// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu` +// and that it can also be turned off with a CLI flag. +// +// This version of the test checks that LLD is used by default when LLD is enabled in the +// toolchain. There is a separate test that checks that LLD is used for dist artifacts +// unconditionally. + +//@ needs-rust-lld +//@ only-x86_64-unknown-linux-gnu + +use run_make_support::linker::{assert_rustc_doesnt_use_lld, assert_rustc_uses_lld}; +use run_make_support::rustc; + +fn main() { + // A regular compilation should use rust-lld by default. + assert_rustc_uses_lld(rustc().input("main.rs")); + + // But it can still be disabled by turning the linker feature off. + assert_rustc_doesnt_use_lld(rustc().arg("-Zlinker-features=-lld").input("main.rs")); +} |
