about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-16 15:07:10 -0400
committerOneirical <manchot@videotron.ca>2024-07-18 09:28:30 -0400
commitaeca91e08df5c1cd5ee5ce858c24e6d02ff1ca69 (patch)
tree94ac6990aba41c5c9ce7da8f61253792e359fe73
parent06dcdbb2eea7eef79eff3f8cd1419c4e05a0e642 (diff)
downloadrust-aeca91e08df5c1cd5ee5ce858c24e6d02ff1ca69.tar.gz
rust-aeca91e08df5c1cd5ee5ce858c24e6d02ff1ca69.zip
rewrite manual-link to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/manual-link/Makefile7
-rw-r--r--tests/run-make/manual-link/rmake.rs16
3 files changed, 16 insertions, 8 deletions
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");
+}