Skip to content

Commit 8c09a7f

Browse files
committed
rewrite raw-dylib-import-name-type to rmake
1 parent 0c8f194 commit 8c09a7f

File tree

3 files changed

+36
-18
lines changed

3 files changed

+36
-18
lines changed

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-import-name-type/Makefile
4544
run-make/raw-dylib-link-ordinal/Makefile
4645
run-make/raw-dylib-stdcall-ordinal/Makefile
4746
run-make/redundant-libs/Makefile

tests/run-make/raw-dylib-import-name-type/Makefile

-17
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+
// 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
7+
// with expected output.
8+
// See https://github.com/rust-lang/rust/pull/100732
9+
10+
//@ only-x86
11+
//@ only-windows
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("bin").input("driver.rs").run();
20+
if is_msvc() {
21+
cc().arg("-c").out_exe("extern").input("extern.c").run();
22+
cc().input("extern.obj")
23+
.arg("extern.msvc.def")
24+
.args(&["-link", "-dll", "-noimplib", "-out:extern.dll"])
25+
.run();
26+
} else {
27+
cc().arg("-v").arg("-c").out_exe("extern.obj").input("extern.c").run();
28+
cc().input("extern.obj")
29+
.arg("extern.gnu.def")
30+
.args(&["--no-leading-underscore", "-shared"])
31+
.output("extern.dll")
32+
.run();
33+
};
34+
let out = run("driver").stdout_utf8();
35+
diff().expected_file("output.txt").actual_text("actual", out).run();
36+
}

0 commit comments

Comments
 (0)