Skip to content

Commit 23cccb3

Browse files
committed
rewrite raw-dylib-stdcall-ordinal to rmake
1 parent 9ffe161 commit 23cccb3

File tree

6 files changed

+47
-30
lines changed

6 files changed

+47
-30
lines changed

Diff for: src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ run-make/print-calling-conventions/Makefile
4141
run-make/print-target-list/Makefile
4242
run-make/raw-dylib-alt-calling-convention/Makefile
4343
run-make/raw-dylib-c/Makefile
44-
run-make/raw-dylib-stdcall-ordinal/Makefile
4544
run-make/redundant-libs/Makefile
4645
run-make/remap-path-prefix-dwarf/Makefile
4746
run-make/reproducible-build-2/Makefile

Diff for: tests/run-make/raw-dylib-import-name-type/rmake.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
// so they may be linked against without linking against an import library.
44
// To learn more, read https://github.com/rust-lang/rfcs/blob/master/text/2627-raw-dylib-kind.md
55
// This test uses this feature alongside `import_name_type`, which allows for customization
6-
// of how Windows symbols will be named. The correctness of this feature is checked by comparison
6+
// of how Windows symbols will be named. A sanity check of this feature is done by comparison
77
// with expected output.
88
// See https://github.com/rust-lang/rust/pull/100732
99

1010
//@ only-x86
1111
//@ only-windows
12+
// Reason: this test specifically exercises a 32bit Windows calling convention.
1213

1314
use run_make_support::{cc, diff, is_msvc, run, rustc};
1415

@@ -32,5 +33,5 @@ fn main() {
3233
.run();
3334
};
3435
let out = run("driver").stdout_utf8();
35-
diff().expected_file("output.txt").actual_text("actual", out).run();
36+
diff().expected_file("output.txt").actual_text("actual", out).normalize(r#"\r"#, "").run();
3637
}

Diff for: tests/run-make/raw-dylib-link-ordinal/rmake.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// `#[link_ordinal(n)]` allows Rust to link against DLLs that export symbols by ordinal rather
66
// than by name. As long as the ordinal matches, the name of the function in Rust is not
77
// required to match the name of the corresponding function in the exporting DLL.
8-
// This test checks the correctness of this feature by comparing its output against expected
8+
// This test is a sanity check for this feature, done by comparing its output against expected
99
// output.
1010
// See https://github.com/rust-lang/rust/pull/89025
1111

@@ -22,16 +22,12 @@ fn main() {
2222
if is_msvc() {
2323
cc().arg("-c").out_exe("exporter").input("exporter.c").run();
2424
cc().input("exporter.obj")
25-
.arg("exporter.msvc.def")
25+
.arg("exporter.def")
2626
.args(&["-link", "-dll", "-noimplib", "-out:exporter.dll"])
2727
.run();
2828
} else {
2929
cc().arg("-v").arg("-c").out_exe("exporter.obj").input("exporter.c").run();
30-
cc().input("exporter.obj")
31-
.arg("exporter.gnu.def")
32-
.args(&["--no-leading-underscore", "-shared"])
33-
.output("exporter.dll")
34-
.run();
30+
cc().input("exporter.obj").arg("exporter.def").arg("-shared").output("exporter.dll").run();
3531
};
3632
let out = run("driver").stdout_utf8();
3733
diff().expected_file("output.txt").actual_text("actual", out).normalize(r#"\r"#, "").run();

Diff for: tests/run-make/raw-dylib-stdcall-ordinal/Makefile

-18
This file was deleted.

Diff for: tests/run-make/raw-dylib-stdcall-ordinal/rmake.rs

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// `raw-dylib` is a Windows-specific attribute which emits idata sections for the items in the
2+
// attached extern block,
3+
// so they may be linked against without linking against an import library.
4+
// To learn more, read https://github.com/rust-lang/rfcs/blob/master/text/2627-raw-dylib-kind.md
5+
// Almost identical to `raw-dylib-link-ordinal`, but with the addition of calling conventions,
6+
// such as stdcall.
7+
// See https://github.com/rust-lang/rust/pull/90782
8+
9+
//@ only-x86
10+
//@ only-windows
11+
// Reason: this test specifically exercises a 32bit Windows calling convention.
12+
13+
use run_make_support::{cc, diff, is_msvc, run, rustc};
14+
15+
// NOTE: build_native_dynamic lib is not used, as the special `def` files
16+
// must be passed to the CC compiler.
17+
18+
fn main() {
19+
rustc().crate_type("lib").crate_name("raw_dylib_test").input("lib.rs").run();
20+
rustc().crate_type("bin").input("driver.rs").run();
21+
if is_msvc() {
22+
cc().arg("-c").out_exe("exporter").input("exporter.c").run();
23+
cc().input("exporter.obj")
24+
.arg("exporter-msvc.def")
25+
.args(&["-link", "-dll", "-noimplib", "-out:exporter.dll"])
26+
.run();
27+
} else {
28+
cc().arg("-v").arg("-c").out_exe("exporter.obj").input("exporter.c").run();
29+
cc().input("exporter.obj")
30+
.arg("exporter-gnu.def")
31+
.arg("-shared")
32+
.output("exporter.dll")
33+
.run();
34+
};
35+
let out = run("driver").stdout_utf8();
36+
diff()
37+
.expected_file("expected_output.txt")
38+
.actual_text("actual", out)
39+
.normalize(r#"\r"#, "")
40+
.run();
41+
}

Diff for: tests/run-make/share-generics-dylib/rmake.rs

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
//
1010
// This is regression test for https://github.com/rust-lang/rust/issues/67276.
1111

12-
//FIXME(Oneirical): ignore-cross-compile
13-
1412
use run_make_support::rustc;
1513

1614
fn main() {

0 commit comments

Comments
 (0)