-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #131917 - jieyouxu:rmake-clang, r=<try>
Run the full stage 2 `run-make` test suite in `x86_64-gnu-debug` Run the full `run-make` test suite in the `x86_64-gnu-debug` CI job. This is currently the *only* CI job where `//@ needs-force-clang-based-test` will be satisfied, so some `run-make` tests will literally never be run otherwise. Before this PR, the CI job only ran `run-make` tests which contains the substring `clang` in its test name, which is both (1) a footgun because it's very easy to forget and (2) it masks tests that would otherwise fail (even failing to compile) because the test is skipped if doesn't have a `clang` in its test name. With the environment of `x86_64-gnu-debug`, two `run-make` tests failed before this PR: 1. `tests/run-make/issue-84395-lto-embed-bitcode/rmake.rs`: this was broken for a long time because `objcopy` in llvm bin tools was renamed to `llvm-objcopy`. This test was converted into a rmake.rs test, rather straight forward. 2. `tests/run-make/cross-lang-lto-riscv-abi/rmake.rs`: this was broken for a long time and never worked. The old version inspected human-readable output of `llvm-readobj --file-header` looking for substring `EF_RISCV_FLOAT_ABI_DOUBLE`, but the human-readable output will only contain something like `Flags: 0x5, RVC, double-float ABI`, hence it will never match. This test was fixed by instead using the `object` crate to actually decode the ELF headers looking for the specific `e_flags` based on reading the RISCV ELF psABI docs. This PR is best reviewed commit-by-commit, two commits setup the support library for functionality and two commits are for each of the failing `run-make` tests. try-job: x86_64-gnu-debug
- Loading branch information
Showing
9 changed files
with
183 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//! Smoke test to make sure the embed bitcode in elf created with | ||
//! `--plugin-opt=-lto-embed-bitcode=optimized` is valid llvm BC module. | ||
//! | ||
//! See <https://github.com/rust-lang/rust/issues/84395> where passing | ||
//! `-lto-embed-bitcode=optimized` to lld when linking rust code via `linker-plugin-lto` doesn't | ||
//! produce the expected result. | ||
//! | ||
//! See PR <https://github.com/rust-lang/rust/pull/98162> which initially introduced this test. | ||
|
||
//@ needs-force-clang-based-tests | ||
|
||
use run_make_support::{env_var, llvm_dis, llvm_objcopy, rustc}; | ||
|
||
fn main() { | ||
rustc() | ||
.input("test.rs") | ||
.arg("-Clink-arg=-fuse-ld=lld") | ||
.arg("-Clinker-plugin-lto") | ||
.arg(format!("-Clinker={}", env_var("CLANG"))) | ||
.arg("-Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized") | ||
.arg("-Zemit-thin-lto=no") | ||
.run(); | ||
|
||
llvm_objcopy().dump_section(".llvmbc", "test.bc").arg("test").run(); | ||
|
||
llvm_dis().arg("test.bc").run(); | ||
} |