From aeca91e08df5c1cd5ee5ce858c24e6d02ff1ca69 Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 16 Jul 2024 15:07:10 -0400 Subject: [PATCH] rewrite manual-link to rmake --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - tests/run-make/manual-link/Makefile | 7 ------- tests/run-make/manual-link/rmake.rs | 16 ++++++++++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) delete mode 100644 tests/run-make/manual-link/Makefile create mode 100644 tests/run-make/manual-link/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 d562a5f4d1b..c7d460659a1 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -72,7 +72,6 @@ run-make/lto-linkage-used-attr/Makefile run-make/lto-no-link-whole-rlib/Makefile run-make/lto-smoke-c/Makefile run-make/macos-deployment-target/Makefile -run-make/manual-link/Makefile run-make/min-global-align/Makefile run-make/missing-crate-dependency/Makefile run-make/native-link-modifier-bundle/Makefile diff --git a/tests/run-make/manual-link/Makefile b/tests/run-make/manual-link/Makefile deleted file mode 100644 index 8dbf0460fff..00000000000 --- a/tests/run-make/manual-link/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -all: $(TMPDIR)/libbar.a - $(RUSTC) foo.rs -lstatic=bar - $(RUSTC) main.rs - $(call RUN,main) diff --git a/tests/run-make/manual-link/rmake.rs b/tests/run-make/manual-link/rmake.rs new file mode 100644 index 00000000000..1d362172263 --- /dev/null +++ b/tests/run-make/manual-link/rmake.rs @@ -0,0 +1,16 @@ +// A smoke test for the `-l` command line rustc flag, which manually links to the selected +// library. Useful for native libraries, this is roughly equivalent to `#[link]` in Rust code. +// If compilation succeeds, the flag successfully linked the native library. +// See https://github.com/rust-lang/rust/pull/18470 + +//@ 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("bar"); + rustc().input("foo.rs").arg("-lstatic=bar").run(); + rustc().input("main.rs").run(); + run("main"); +}