From db8398db6f79ad70ce4598372bf807c68b62ea13 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 12 Jul 2024 15:49:26 -0400 Subject: [PATCH] rewrite lto-no-link-whole-rlib to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/lto-no-link-whole-rlib/Makefile | 9 --------- tests/run-make/lto-no-link-whole-rlib/rmake.rs | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) delete mode 100644 tests/run-make/lto-no-link-whole-rlib/Makefile create mode 100644 tests/run-make/lto-no-link-whole-rlib/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 421097a4bdf..3f5de1f7c15 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -52,7 +52,6 @@ run-make/linkage-attr-on-static/Makefile run-make/long-linker-command-lines-cmd-exe/Makefile run-make/long-linker-command-lines/Makefile run-make/lto-linkage-used-attr/Makefile -run-make/lto-no-link-whole-rlib/Makefile run-make/macos-deployment-target/Makefile run-make/min-global-align/Makefile run-make/native-link-modifier-bundle/Makefile diff --git a/tests/run-make/lto-no-link-whole-rlib/Makefile b/tests/run-make/lto-no-link-whole-rlib/Makefile deleted file mode 100644 index 3e82322e72d..00000000000 --- a/tests/run-make/lto-no-link-whole-rlib/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) - $(RUSTC) lib1.rs - $(RUSTC) lib2.rs - $(RUSTC) main.rs -Clto - $(call RUN,main) - diff --git a/tests/run-make/lto-no-link-whole-rlib/rmake.rs b/tests/run-make/lto-no-link-whole-rlib/rmake.rs new file mode 100644 index 00000000000..8cd653d5f08 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/rmake.rs @@ -0,0 +1,18 @@ +// In order to improve linking performance, entire rlibs will only be linked if a dylib is being +// created. Otherwise, an executable will only link one rlib as usual. Linking will fail in this +// test should this optimization be reverted. +// See https://github.com/rust-lang/rust/pull/31460 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{build_native_static_lib, run, rustc}; + +fn main() { + build_native_static_lib("foo"); + build_native_static_lib("bar"); + rustc().input("lib1.rs").run(); + rustc().input("lib2.rs").run(); + rustc().input("main.rs").arg("-Clto").run(); + run("main"); +}