Skip to content

Commit e6fc319

Browse files
committed
rewrite native-link-modifier-linker to rmake
1 parent 5f2b47f commit e6fc319

File tree

4 files changed

+37
-16
lines changed

4 files changed

+37
-16
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ run-make/missing-crate-dependency/Makefile
142142
run-make/mixing-libs/Makefile
143143
run-make/msvc-opt-minsize/Makefile
144144
run-make/native-link-modifier-bundle/Makefile
145-
run-make/native-link-modifier-verbatim-linker/Makefile
146145
run-make/native-link-modifier-whole-archive/Makefile
147146
run-make/no-alloc-shim/Makefile
148147
run-make/no-builtins-attribute/Makefile

tests/run-make/native-link-modifier-verbatim-linker/Makefile

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// `verbatim` is a native link modifier that forces rustc to only accept libraries with
2+
// a specified name. This test checks that this modifier works as intended.
3+
// This test is the same as native-link-modifier-rustc, but without rlibs.
4+
// See https://github.com/rust-lang/rust/issues/99425
5+
6+
use run_make_support::rustc;
7+
8+
fn main() {
9+
// Verbatim allows for the specification of a precise name - in this case, the unconventional ".ext" extension.
10+
rustc()
11+
.input("local_native_dep.rs")
12+
.crate_type("staticlib")
13+
.output("local_some_strange_name.ext")
14+
.run();
15+
rustc().input("main.rs").arg("-lstatic:+verbatim=local_some_strange_name.ext").run();
16+
17+
// This section voluntarily avoids using static_lib_name helpers to be verbatim.
18+
// With verbatim, even these common library names are refused - it wants local_native_dep without
19+
// any file extensions.
20+
rustc()
21+
.input("local_native_dep.rs")
22+
.crate_type("staticlib")
23+
.output("liblocal_native_dep.a")
24+
.run();
25+
rustc().input("local_native_dep.rs").crate_type("staticlib").output("local_native_dep.a").run();
26+
rustc()
27+
.input("local_native_dep.rs")
28+
.crate_type("staticlib")
29+
.output("local_native_dep.lib")
30+
.run();
31+
rustc()
32+
.input("main.rs")
33+
.arg("-lstatic:+verbatim=local_native_dep")
34+
.run_fail()
35+
.assert_stderr_contains("local_native_dep");
36+
}

tests/run-make/native-link-modifier-verbatim-rustc/rmake.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// `verbatim` is a native link modifier that forces rustc to only accept libraries with
22
// a specified name. This test checks that this modifier works as intended.
3+
// This test is the same as native-link-modifier-linker, but with rlibs.
34
// See https://github.com/rust-lang/rust/issues/99425
45

56
use run_make_support::rustc;

0 commit comments

Comments
 (0)