Skip to content

Commit 25380bc

Browse files
committed
rewrite and rename issue-84395-lto-embed-bitcode to rmake
1 parent 9fc297f commit 25380bc

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ run-make/dep-info-spaces/Makefile
99
run-make/dep-info/Makefile
1010
run-make/emit-to-stdout/Makefile
1111
run-make/extern-fn-reachable/Makefile
12-
run-make/issue-84395-lto-embed-bitcode/Makefile
1312
run-make/issue-88756-default-output/Makefile
1413
run-make/jobserver-error/Makefile
1514
run-make/libs-through-symlinks/Makefile

tests/run-make/incr-add-rust-src-component/rmake.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// rust-lang/rust#70924: Test that if we add rust-src component in between two
2-
// incremental compiles, the compiler does not ICE on the second.
1+
// rust-lang/rust#70924: Test that if we add rust-src component in between
2+
// two incremental compiles, the compiler does not ICE on the second.
33
// Remove the rust-src part of the sysroot for the *first* build.
44
// Then put in a facsimile of the rust-src
55
// component for the second build, in order to expose the ICE from issue #70924.
@@ -13,7 +13,6 @@ use run_make_support::{path, rfs, rustc};
1313
fn main() {
1414
let sysroot = rustc().print("sysroot").run().stdout_utf8();
1515
let sysroot = sysroot.trim();
16-
let sysroot = format!("{sysroot}-sysroot");
1716
rfs::remove_dir_all(path(&sysroot).join("lib/rustlib/src/rust"));
1817
rustc().arg("--sysroot").arg(&sysroot).incremental("incr").input("main.rs").run();
1918
rfs::create_dir_all(path(&sysroot).join("lib/rustlib/src/rust/src/libstd"));

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,30 @@
1+
// This test checks that the embed bitcode in elf created with
2+
// lto-embed-bitcode=optimized is a valid llvm bitcode module.
3+
// Otherwise, the `test.bc` file will cause an error when
4+
// `llvm-dis` attempts to disassemble it.
5+
// See https://github.com/rust-lang/rust/issues/84395
6+
7+
//@ needs-force-clang-based-tests
8+
// NOTE(#126180): This test only runs on `x86_64-gnu-debug`, because that CI job sets
9+
// RUSTBUILD_FORCE_CLANG_BASED_TESTS and only runs tests which contain "clang" in their
10+
// name.
11+
12+
use run_make_support::llvm::llvm_bin_dir;
13+
use run_make_support::{cmd, env_var, rustc};
14+
15+
fn main() {
16+
rustc()
17+
.input("test.rs")
18+
.link_arg("-fuse-ld=lld")
19+
.arg("linker-plugin-lto")
20+
.linker(&env_var("CLANG"))
21+
.link_arg("-Wl,--plugin-opt=-lto-embed-bitcode=optimized")
22+
.arg("-Zemit-thin-lto=no")
23+
.run();
24+
cmd(llvm_bin_dir().join("objcopy"))
25+
.arg("--dump-section")
26+
.arg(".llvmbc=test.bc")
27+
.arg("test")
28+
.run();
29+
cmd(llvm_bin_dir().join("llvm-dis")).arg("test.bc").run();
30+
}

0 commit comments

Comments
 (0)