Skip to content

Commit 1358c84

Browse files
committed
rewrite raw-dylib-stdcall-ordinal to rmake
1 parent b9ddc2f commit 1358c84

File tree

4 files changed

+38
-25
lines changed

4 files changed

+38
-25
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ run-make/print-calling-conventions/Makefile
6161
run-make/print-target-list/Makefile
6262
run-make/raw-dylib-alt-calling-convention/Makefile
6363
run-make/raw-dylib-c/Makefile
64-
run-make/raw-dylib-stdcall-ordinal/Makefile
6564
run-make/redundant-libs/Makefile
6665
run-make/remap-path-prefix-dwarf/Makefile
6766
run-make/reproducible-build-2/Makefile

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -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();

tests/run-make/raw-dylib-stdcall-ordinal/Makefile

-18
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
12+
use run_make_support::{cc, diff, is_msvc, run, rustc};
13+
14+
// NOTE: build_native_dynamic lib is not used, as the special `def` files
15+
// must be passed to the CC compiler.
16+
17+
fn main() {
18+
rustc().crate_type("lib").crate_name("raw_dylib_test").input("lib.rs").run();
19+
rustc().crate_type("bin").input("driver.rs").run();
20+
if is_msvc() {
21+
cc().arg("-c").out_exe("exporter").input("exporter.c").run();
22+
cc().input("exporter.obj")
23+
.arg("exporter-msvc.def")
24+
.args(&["-link", "-dll", "-noimplib", "-out:exporter.dll"])
25+
.run();
26+
} else {
27+
cc().arg("-v").arg("-c").out_exe("exporter.obj").input("exporter.c").run();
28+
cc().input("exporter.obj")
29+
.arg("exporter-gnu.def")
30+
.arg("-shared")
31+
.output("exporter.dll")
32+
.run();
33+
};
34+
let out = run("driver").stdout_utf8();
35+
diff().expected_file("output.txt").actual_text("actual", out).normalize(r#"\r"#, "").run();
36+
}

0 commit comments

Comments
 (0)