From 1f5837ae2506d5439b31195b7fcf784b9ee90d2b Mon Sep 17 00:00:00 2001 From: Oneirical Date: Sat, 11 May 2024 17:20:31 -0400 Subject: [PATCH 1/2] rewrite c-link-to-rust-staticlib --- .../tidy/src/allowed_run_make_makefiles.txt | 1 - .../c-link-to-rust-staticlib/Makefile | 16 --------------- .../c-link-to-rust-staticlib/rmake.rs | 20 +++++++++++++++++++ 3 files changed, 20 insertions(+), 17 deletions(-) delete mode 100644 tests/run-make/c-link-to-rust-staticlib/Makefile create mode 100644 tests/run-make/c-link-to-rust-staticlib/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 5f68f779c4eb0..37acd768593eb 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -8,7 +8,6 @@ run-make/branch-protection-check-IBT/Makefile run-make/c-dynamic-dylib/Makefile run-make/c-dynamic-rlib/Makefile run-make/c-link-to-rust-dylib/Makefile -run-make/c-link-to-rust-staticlib/Makefile run-make/c-static-dylib/Makefile run-make/c-static-rlib/Makefile run-make/c-unwind-abi-catch-lib-panic/Makefile diff --git a/tests/run-make/c-link-to-rust-staticlib/Makefile b/tests/run-make/c-link-to-rust-staticlib/Makefile deleted file mode 100644 index d36cc421c468a..0000000000000 --- a/tests/run-make/c-link-to-rust-staticlib/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# This test checks that C linking with Rust does not encounter any errors, with static libraries. -# See https://github.com/rust-lang/rust/issues/10434 - -# ignore-cross-compile -include ../tools.mk - -# ignore-freebsd -# FIXME - -all: - $(RUSTC) foo.rs - $(CC) bar.c $(call STATICLIB,foo) $(call OUT_EXE,bar) \ - $(EXTRACFLAGS) $(EXTRACXXFLAGS) - $(call RUN,bar) - rm $(call STATICLIB,foo) - $(call RUN,bar) diff --git a/tests/run-make/c-link-to-rust-staticlib/rmake.rs b/tests/run-make/c-link-to-rust-staticlib/rmake.rs new file mode 100644 index 0000000000000..d73ca413777d2 --- /dev/null +++ b/tests/run-make/c-link-to-rust-staticlib/rmake.rs @@ -0,0 +1,20 @@ +// This test checks that C linking with Rust does not encounter any errors, with a static library. +// See https://github.com/rust-lang/rust/issues/10434 + +//@ ignore-cross-compile + +use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib}; +use std::fs; + +fn main() { + rustc().input("foo.rs").run(); + cc().input("bar.c") + .input(static_lib("foo")) + .out_exe("bar") + .args(&extra_c_flags()) + .args(&extra_cxx_flags()) + .run(); + run("bar"); + fs::remove_file(static_lib("foo")); + run("bar"); +} From b1e5e5161a2ef27852aab40cf3472187bdda5fee Mon Sep 17 00:00:00 2001 From: Julien <96022417+Oneirical@users.noreply.github.com> Date: Tue, 14 May 2024 16:43:39 -0400 Subject: [PATCH 2/2] remove cxx_flags --- tests/run-make/c-link-to-rust-staticlib/rmake.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/run-make/c-link-to-rust-staticlib/rmake.rs b/tests/run-make/c-link-to-rust-staticlib/rmake.rs index d73ca413777d2..762d7953a9a0f 100644 --- a/tests/run-make/c-link-to-rust-staticlib/rmake.rs +++ b/tests/run-make/c-link-to-rust-staticlib/rmake.rs @@ -3,7 +3,7 @@ //@ ignore-cross-compile -use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib}; +use run_make_support::{cc, extra_c_flags, run, rustc, static_lib}; use std::fs; fn main() { @@ -12,7 +12,6 @@ fn main() { .input(static_lib("foo")) .out_exe("bar") .args(&extra_c_flags()) - .args(&extra_cxx_flags()) .run(); run("bar"); fs::remove_file(static_lib("foo"));