about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-25 14:27:43 -0400
committerOneirical <manchot@videotron.ca>2024-06-25 14:27:43 -0400
commit6ba0a84df9172ea01f3c3661b4d8364e5a79ba69 (patch)
tree13da0f19fed3f5132d614806eecb69470d760431
parentc290e9de32e8ba6a673ef125fde40eadd395d170 (diff)
downloadrust-6ba0a84df9172ea01f3c3661b4d8364e5a79ba69.tar.gz
rust-6ba0a84df9172ea01f3c3661b4d8364e5a79ba69.zip
rewrite lto-empty to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/lto-empty/Makefile13
-rw-r--r--tests/run-make/lto-empty/rmake.rs17
3 files changed, 17 insertions, 14 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 07073ef5d40..7c882d3ce15 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -97,7 +97,6 @@ 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-empty/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-empty/Makefile b/tests/run-make/lto-empty/Makefile
deleted file mode 100644
index 1b795c4b738..00000000000
--- a/tests/run-make/lto-empty/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all: cdylib-fat cdylib-thin
-
-cdylib-fat:
-	$(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat
-	$(RUSTC) lib.rs -C lto=fat -C opt-level=3 -C incremental=$(TMPDIR)/inc-fat
-
-cdylib-thin:
-	$(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin
-	$(RUSTC) lib.rs -C lto=thin -C opt-level=3 -C incremental=$(TMPDIR)/inc-thin
-
diff --git a/tests/run-make/lto-empty/rmake.rs b/tests/run-make/lto-empty/rmake.rs
new file mode 100644
index 00000000000..7146d6e10ef
--- /dev/null
+++ b/tests/run-make/lto-empty/rmake.rs
@@ -0,0 +1,17 @@
+// Compiling Rust code twice in a row with "fat" link-time-optimizations used to cause
+// an internal compiler error (ICE). This was due to how the compiler would cache some modules
+// to make subsequent compilations faster, at least one of which was required for LTO to link
+// into. After this was patched in #63956, this test checks that the bug does not make
+// a resurgence.
+// See https://github.com/rust-lang/rust/issues/63349
+
+//@ ignore-cross-compile
+
+use run_make_support::rustc;
+
+fn main() {
+    rustc().input("lib.rs").arg("-Clto=fat").opt_level("3").incremental("inc-fat").run();
+    rustc().input("lib.rs").arg("-Clto=fat").opt_level("3").incremental("inc-fat").run();
+    rustc().input("lib.rs").arg("-Clto=thin").opt_level("3").incremental("inc-thin").run();
+    rustc().input("lib.rs").arg("-Clto=thin").opt_level("3").incremental("inc-thin").run();
+}