From c6bb35750265cc9e630fb49d96ab5721ceb57136 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Wed, 26 Jun 2024 13:32:30 -0400 Subject: [PATCH] rewrite lto-dylib-dep to rmake --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/lto-dylib-dep/Makefile | 11 ----------- tests/run-make/lto-dylib-dep/rmake.rs | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) delete mode 100644 tests/run-make/lto-dylib-dep/Makefile create mode 100644 tests/run-make/lto-dylib-dep/rmake.rs diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 9d3c08ec832..9d44b61d5e1 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -94,7 +94,6 @@ run-make/llvm-ident/Makefile run-make/long-linker-command-lines-cmd-exe/Makefile run-make/long-linker-command-lines/Makefile run-make/longjmp-across-rust/Makefile -run-make/lto-dylib-dep/Makefile run-make/lto-linkage-used-attr/Makefile run-make/lto-no-link-whole-rlib/Makefile run-make/lto-smoke-c/Makefile diff --git a/tests/run-make/lto-dylib-dep/Makefile b/tests/run-make/lto-dylib-dep/Makefile deleted file mode 100644 index a9344597d08..00000000000 --- a/tests/run-make/lto-dylib-dep/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -# Test that we don't run into an assertion when using a Rust dylib dependency -# while compiling with full LTO. -# See https://github.com/rust-lang/rust/issues/59137 - -all: - $(RUSTC) a_dylib.rs --crate-type=dylib -C prefer-dynamic - $(RUSTC) main.rs -C lto - $(call RUN,main) diff --git a/tests/run-make/lto-dylib-dep/rmake.rs b/tests/run-make/lto-dylib-dep/rmake.rs new file mode 100644 index 00000000000..842fce467d4 --- /dev/null +++ b/tests/run-make/lto-dylib-dep/rmake.rs @@ -0,0 +1,15 @@ +// Compiling with link-time-optimizations (LTO) would previously run into an internal +// compiler error (ICE) if a dylib was passed as a required library. This was due to a +// misplaced assert! call in the compiler, which is now removed. This test checks that +// this bug does not make a resurgence and that dylib+lto compilation succeeds. +// See https://github.com/rust-lang/rust/issues/59137 + +//@ ignore-cross-compile + +use run_make_support::{run, rustc}; + +fn main() { + rustc().input("a_dylib.rs").crate_type("dylib").arg("-Cprefer-dynamic").run(); + rustc().input("main.rs").arg("-Clto").run(); + run("main"); +}