From a2ed16cc061f4b25c673d0f53264e5c7c389eb9b Mon Sep 17 00:00:00 2001 From: Oneirical Date: Fri, 21 Jun 2024 16:00:53 -0400 Subject: [PATCH] rewrite mingw-export-call-convention to rmake --- src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 - .../run-make/mingw-export-call-convention/Makefile | 9 --------- .../run-make/mingw-export-call-convention/rmake.rs | 13 +++++++++++++ tests/run-make/pdb-alt-path/rmake.rs | 14 ++++++++------ 4 files changed, 21 insertions(+), 16 deletions(-) delete mode 100644 tests/run-make/mingw-export-call-convention/Makefile create mode 100644 tests/run-make/mingw-export-call-convention/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 f8b0742a55c..a029c20dec3 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -110,7 +110,6 @@ run-make/manual-link/Makefile run-make/many-crates-but-no-match/Makefile run-make/metadata-dep-info/Makefile run-make/min-global-align/Makefile -run-make/mingw-export-call-convention/Makefile run-make/missing-crate-dependency/Makefile run-make/mixing-libs/Makefile run-make/msvc-opt-minsize/Makefile diff --git a/tests/run-make/mingw-export-call-convention/Makefile b/tests/run-make/mingw-export-call-convention/Makefile deleted file mode 100644 index 4a60059cc54..00000000000 --- a/tests/run-make/mingw-export-call-convention/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../tools.mk - -# only-windows-gnu - -all: - $(RUSTC) foo.rs - # FIXME: we should make sure __stdcall calling convention is used here - # but that only works with LLD right now - nm -g "$(call IMPLIB,foo)" | $(CGREP) bar diff --git a/tests/run-make/mingw-export-call-convention/rmake.rs b/tests/run-make/mingw-export-call-convention/rmake.rs new file mode 100644 index 00000000000..d1fb745a64d --- /dev/null +++ b/tests/run-make/mingw-export-call-convention/rmake.rs @@ -0,0 +1,13 @@ +// On windows-gnu, symbol exporting used to fail to export names +// with no_mangle. #72049 brought this feature up to par with msvc, +// and this test checks that the symbol "bar" is successfully exported. +// See https://github.com/rust-lang/rust/issues/50176 + +//@ only-x86_64-pc-windows-gnu + +use run_make_support::{llvm_readobj, rustc}; + +fn main() { + rustc().input("foo.rs").run(); + llvm_readobj().arg("--all").input("libfoo.dll.a").run().assert_stdout_contains("bar"); +} diff --git a/tests/run-make/pdb-alt-path/rmake.rs b/tests/run-make/pdb-alt-path/rmake.rs index 15497be4ecf..6311d6d9ed7 100644 --- a/tests/run-make/pdb-alt-path/rmake.rs +++ b/tests/run-make/pdb-alt-path/rmake.rs @@ -5,7 +5,9 @@ // checks that no full file paths are exposed and that the override flag is respected. // See https://github.com/rust-lang/rust/pull/121297 -//@ only-windows +//@ only-x86_64-pc-windows-msvc + +use run_make_support::{bin_name, invalid_utf8_contains, invalid_utf8_not_contains, run, rustc}; fn main() { // Test that we don't have the full path to the PDB file in the binary @@ -16,11 +18,11 @@ fn main() { .crate_type("bin") .arg("-Cforce-frame-pointers") .run(); - invalid_utf8_contains(bin_name("my_crate_name"), "my_crate_name.pdb"); - invalid_utf8_not_contains(bin_name("my_crate_name"), r#"\my_crate_name.pdb"#); + invalid_utf8_contains(&bin_name("my_crate_name"), "my_crate_name.pdb"); + invalid_utf8_not_contains(&bin_name("my_crate_name"), r#"\my_crate_name.pdb"#); // Test that backtraces still can find debuginfo by checking that they contain symbol names and // source locations. - let out = run(bin_name(my_crate_name)); + let out = run(&bin_name("my_crate_name")); out.assert_stdout_contains("my_crate_name::fn_in_backtrace"); out.assert_stdout_contains("main.rs:15"); // Test that explicitly passed `-Clink-arg=/PDBALTPATH:...` is respected @@ -32,6 +34,6 @@ fn main() { .link_arg("/PDBALTPATH:abcdefg.pdb") .arg("-Cforce-frame-pointers") .run(); - invalid_utf8_contains(bin_name("my_crate_name"), "abcdefg.pdb"); - invalid_utf8_not_contains(bin_name("my_crate_name"), "my_crate_name.pdb"); + invalid_utf8_contains(&bin_name("my_crate_name"), "abcdefg.pdb"); + invalid_utf8_not_contains(&bin_name("my_crate_name"), "my_crate_name.pdb"); }