Skip to content

Commit 84249cd

Browse files
jieyouxuOneirical
andcommitted
tests/run-make: port issue-84395-lto-embed-bitcode to rmake.rs
Co-authored-by: Oneirical <manchot@videotron.ca>
1 parent bcadf80 commit 84249cd

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ run-make/branch-protection-check-IBT/Makefile
22
run-make/cat-and-grep-sanity-check/Makefile
33
run-make/extern-fn-reachable/Makefile
44
run-make/incr-add-rust-src-component/Makefile
5-
run-make/issue-84395-lto-embed-bitcode/Makefile
65
run-make/jobserver-error/Makefile
76
run-make/libs-through-symlinks/Makefile
87
run-make/split-debuginfo/Makefile

tests/run-make/issue-84395-lto-embed-bitcode/Makefile

-14
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! Smoke test to make sure the embed bitcode in elf created with
2+
//! `--plugin-opt=-lto-embed-bitcode=optimized` is valid llvm BC module.
3+
//!
4+
//! See <https://github.com/rust-lang/rust/issues/84395> where passing
5+
//! `-lto-embed-bitcode=optimized` to lld when linking rust code via `linker-plugin-lto` doesn't
6+
//! produce the expected result.
7+
//!
8+
//! See PR <https://github.com/rust-lang/rust/pull/98162> which initially introduced this test.
9+
10+
//@ needs-force-clang-based-tests
11+
12+
use run_make_support::{env_var, llvm_dis, llvm_objcopy, rustc};
13+
14+
fn main() {
15+
rustc()
16+
.input("test.rs")
17+
.arg("-Clink-arg=-fuse-ld=lld")
18+
.arg("-Clinker-plugin-lto")
19+
.arg(format!("-Clinker={}", env_var("CLANG")))
20+
.arg("-Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized")
21+
.arg("-Zemit-thin-lto=no")
22+
.run();
23+
24+
llvm_objcopy().dump_section(".llvmbc", "test.bc").arg("test").run();
25+
26+
llvm_dis().arg("test.bc").run();
27+
}

0 commit comments

Comments
 (0)