Skip to content

Commit

Permalink
rewrite and rename issue-84395-lto-embed-bitcode to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Aug 5, 2024
1 parent 38b1486 commit 76a7e72
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ run-make/dep-info-spaces/Makefile
run-make/dep-info/Makefile
run-make/emit-to-stdout/Makefile
run-make/extern-fn-reachable/Makefile
run-make/issue-84395-lto-embed-bitcode/Makefile
run-make/jobserver-error/Makefile
run-make/libs-through-symlinks/Makefile
run-make/libtest-json/Makefile
Expand Down
5 changes: 2 additions & 3 deletions tests/run-make/incr-add-rust-src-component/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// rust-lang/rust#70924: Test that if we add rust-src component in between two
// incremental compiles, the compiler does not ICE on the second.
// rust-lang/rust#70924: Test that if we add rust-src component in between
// two incremental compiles, the compiler does not ICE on the second.
// Remove the rust-src part of the sysroot for the *first* build.
// Then put in a facsimile of the rust-src
// component for the second build, in order to expose the ICE from issue #70924.
Expand All @@ -13,7 +13,6 @@ use run_make_support::{path, rfs, rustc};
fn main() {
let sysroot = rustc().print("sysroot").run().stdout_utf8();
let sysroot = sysroot.trim();
let sysroot = format!("{sysroot}-sysroot");
rfs::remove_dir_all(path(&sysroot).join("lib/rustlib/src/rust"));
rustc().arg("--sysroot").arg(&sysroot).incremental("incr").input("main.rs").run();
rfs::create_dir_all(path(&sysroot).join("lib/rustlib/src/rust/src/libstd"));
Expand Down
14 changes: 0 additions & 14 deletions tests/run-make/issue-84395-lto-embed-bitcode/Makefile

This file was deleted.

30 changes: 30 additions & 0 deletions tests/run-make/lto-embed-bitcode-clang/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This test checks that the embed bitcode in elf created with
// lto-embed-bitcode=optimized is a valid llvm bitcode module.
// Otherwise, the `test.bc` file will cause an error when
// `llvm-dis` attempts to disassemble it.
// See https://github.com/rust-lang/rust/issues/84395

//@ needs-force-clang-based-tests
// NOTE(#126180): This test only runs on `x86_64-gnu-debug`, because that CI job sets
// RUSTBUILD_FORCE_CLANG_BASED_TESTS and only runs tests which contain "clang" in their
// name.

use run_make_support::llvm::llvm_bin_dir;
use run_make_support::{cmd, env_var, rustc};

fn main() {
rustc()
.input("test.rs")
.link_arg("-fuse-ld=lld")
.arg("-Clinker-plugin-lto")
.linker(&env_var("CLANG"))
.link_arg("-Wl,--plugin-opt=-lto-embed-bitcode=optimized")
.arg("-Zemit-thin-lto=no")
.run();
cmd(llvm_bin_dir().join("objcopy"))
.arg("--dump-section")
.arg(".llvmbc=test.bc")
.arg("test")
.run();
cmd(llvm_bin_dir().join("llvm-dis")).arg("test.bc").run();
}

0 comments on commit 76a7e72

Please sign in to comment.