about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-18 13:42:15 -0400
committerOneirical <manchot@videotron.ca>2024-07-18 13:42:15 -0400
commit741cf9167849d39cc31edf27a11c7f77da437445 (patch)
treee72e331e48f479dc24072090ec04ea8bc6ccc909 /tests
parent5753b3067662e17a69b54b9418dbc37b73769a84 (diff)
downloadrust-741cf9167849d39cc31edf27a11c7f77da437445.tar.gz
rust-741cf9167849d39cc31edf27a11c7f77da437445.zip
rewrite lto-smoke-c to rmake
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/lto-smoke-c/Makefile12
-rw-r--r--tests/run-make/lto-smoke-c/rmake.rs20
2 files changed, 20 insertions, 12 deletions
diff --git a/tests/run-make/lto-smoke-c/Makefile b/tests/run-make/lto-smoke-c/Makefile
deleted file mode 100644
index f1ba3d95da2..00000000000
--- a/tests/run-make/lto-smoke-c/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# Apparently older versions of GCC segfault if -g is passed...
-CC := $(CC:-g=)
-
-all:
-	$(RUSTC) foo.rs -C lto
-	$(CC) bar.c $(call STATICLIB,foo) \
-		$(call OUT_EXE,bar) \
-		$(EXTRACFLAGS) $(EXTRACXXFLAGS)
-	$(call RUN,bar)
diff --git a/tests/run-make/lto-smoke-c/rmake.rs b/tests/run-make/lto-smoke-c/rmake.rs
new file mode 100644
index 00000000000..66e19ae7482
--- /dev/null
+++ b/tests/run-make/lto-smoke-c/rmake.rs
@@ -0,0 +1,20 @@
+// LLVM's link-time-optimization (LTO) is a useful feature added to Rust in response
+// to #10741. This test uses this feature with `-C lto` alongside a native C library,
+// and checks that compilation and execution is successful.
+// See https://github.com/rust-lang/rust/issues/10741
+
+//@ ignore-cross-compile
+// Reason: the compiled binary is executed
+
+use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name};
+
+fn main() {
+    rustc().input("foo.rs").arg("-Clto").run();
+    cc().input("bar.c")
+        .arg(static_lib_name("foo"))
+        .out_exe("bar")
+        .args(&extra_c_flags())
+        .args(&extra_cxx_flags())
+        .run();
+    run("bar");
+}