Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 89e8752

Browse files
committedJun 17, 2024
rewrite native-link-modifier-linker to rmake
1 parent 5f2b47f commit 89e8752

File tree

5 files changed

+47
-19
lines changed

5 files changed

+47
-19
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,38 @@
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
10+
// - in this case, the unconventional ".ext" extension.
11+
rustc()
12+
.input("local_native_dep.rs")
13+
.crate_type("staticlib")
14+
.output("local_some_strange_name.ext")
15+
.run();
16+
rustc().input("main.rs").arg("-lstatic:+verbatim=local_some_strange_name.ext").run();
17+
18+
// This section voluntarily avoids using static_lib_name helpers to be verbatim.
19+
// With verbatim, even these common library names are refused
20+
// - it wants local_native_dep without
21+
// any file extensions.
22+
rustc()
23+
.input("local_native_dep.rs")
24+
.crate_type("staticlib")
25+
.output("liblocal_native_dep.a")
26+
.run();
27+
rustc().input("local_native_dep.rs").crate_type("staticlib").output("local_native_dep.a").run();
28+
rustc()
29+
.input("local_native_dep.rs")
30+
.crate_type("staticlib")
31+
.output("local_native_dep.lib")
32+
.run();
33+
rustc()
34+
.input("main.rs")
35+
.arg("-lstatic:+verbatim=local_native_dep")
36+
.run_fail()
37+
.assert_stderr_contains("local_native_dep");
38+
}

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
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;
67

78
fn main() {
8-
// Verbatim allows for the specification of a precise name - in this case, the unconventional ".ext" extension.
9+
// Verbatim allows for the specification of a precise name
10+
// - in this case, the unconventional ".ext" extension.
911
rustc()
1012
.input("upstream_native_dep.rs")
1113
.crate_type("staticlib")
@@ -18,7 +20,8 @@ fn main() {
1820
.run();
1921

2022
// This section voluntarily avoids using static_lib_name helpers to be verbatim.
21-
// With verbatim, even these common library names are refused - it wants upstream_native_dep without
23+
// With verbatim, even these common library names are refused
24+
// - it wants upstream_native_dep without
2225
// any file extensions.
2326
rustc()
2427
.input("upstream_native_dep.rs")

‎tests/run-make/output-filename-conflicts-with-directory/rmake.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@ use run_make_support::{fs_wrapper, rustc};
77

88
fn main() {
99
fs_wrapper::create_dir("foo");
10-
rustc().input("foo.rs").output("foo").run_fail().assert_stderr_contains(r#"the generated executable for the input file "foo.rs" conflicts with the existing directory "foo""#);
10+
rustc().input("foo.rs").output("foo").run_fail().assert_stderr_contains(
11+
r#"the generated executable for the input file "foo.rs"
12+
conflicts with the existing directory "foo""#,
13+
);
1114
}

0 commit comments

Comments
 (0)
Failed to load comments.