diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 6340d204b2d4f..77c121d3fb080 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -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 diff --git a/tests/run-make/incr-add-rust-src-component/rmake.rs b/tests/run-make/incr-add-rust-src-component/rmake.rs index b43cf9cb027ea..9b1be6e045b05 100644 --- a/tests/run-make/incr-add-rust-src-component/rmake.rs +++ b/tests/run-make/incr-add-rust-src-component/rmake.rs @@ -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. @@ -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")); diff --git a/tests/run-make/issue-84395-lto-embed-bitcode/Makefile b/tests/run-make/issue-84395-lto-embed-bitcode/Makefile deleted file mode 100644 index aabe90754a654..0000000000000 --- a/tests/run-make/issue-84395-lto-embed-bitcode/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# needs-force-clang-based-tests - -# FIXME(#126180): This test doesn't actually run anywhere, because the only -# CI job that sets RUSTBUILD_FORCE_CLANG_BASED_TESTS runs very few tests. - -# This test makes sure the embed bitcode in elf created with -# lto-embed-bitcode=optimized is valid llvm BC module. - -include ../tools.mk - -all: - $(RUSTC) test.rs --target $(TARGET) -Clink-arg=-fuse-ld=lld -Clinker-plugin-lto -Clinker=$(CLANG) -Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized -Zemit-thin-lto=no - $(LLVM_BIN_DIR)/objcopy --dump-section .llvmbc=$(TMPDIR)/test.bc $(TMPDIR)/test - $(LLVM_BIN_DIR)/llvm-dis $(TMPDIR)/test.bc diff --git a/tests/run-make/lto-embed-bitcode-clang/rmake.rs b/tests/run-make/lto-embed-bitcode-clang/rmake.rs new file mode 100644 index 0000000000000..4cf59ee088df7 --- /dev/null +++ b/tests/run-make/lto-embed-bitcode-clang/rmake.rs @@ -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(); +} diff --git a/tests/run-make/issue-84395-lto-embed-bitcode/test.rs b/tests/run-make/lto-embed-bitcode-clang/test.rs similarity index 100% rename from tests/run-make/issue-84395-lto-embed-bitcode/test.rs rename to tests/run-make/lto-embed-bitcode-clang/test.rs