Skip to content

Commit 9f994b6

Browse files
committed
rewrite pass-linker-flags-from-dep to rmake
1 parent bc76592 commit 9f994b6

File tree

4 files changed

+45
-14
lines changed

4 files changed

+45
-14
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ run-make/optimization-remarks-dir-pgo/Makefile
106106
run-make/optimization-remarks-dir/Makefile
107107
run-make/output-type-permutations/Makefile
108108
run-make/panic-abort-eh_frame/Makefile
109-
run-make/pass-linker-flags-from-dep/Makefile
110109
run-make/pass-non-c-like-enum-to-c/Makefile
111110
run-make/pdb-buildinfo-cl-cmd/Makefile
112111
run-make/pgo-gen-lto/Makefile

tests/run-make/pass-linker-flags-flavor/rmake.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// explicit flags and then with those flags passed inside the rust source code.
55
// See https://github.com/rust-lang/rust/pull/118202
66

7-
//FIXME(Oneirical): only-linux
7+
//@ only-linux
8+
// Reason: the `gnu-cc` linker is only available on linux
89

910
use run_make_support::{regex, rustc};
1011

tests/run-make/pass-linker-flags-from-dep/Makefile

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// A similar test to pass-linker-flags, testing that the `-l link-arg` flag
2+
// respects the order relative to other `-l` flags, but this time, the flags
3+
// are passed on the compilation of a dependency. This test checks that the
4+
// downstream compiled binary contains the linker arguments of the dependency,
5+
// and in the correct order.
6+
// See https://github.com/rust-lang/rust/issues/99427
7+
8+
use run_make_support::{regex, rust_lib_name, rustc};
9+
10+
fn main() {
11+
// Build dependencies
12+
rustc().input("native_dep_1.rs").crate_type("staticlib").run();
13+
rustc().input("native_dep_2.rs").crate_type("staticlib").run();
14+
rustc()
15+
.input("rust_dep_flag.rs")
16+
.arg("-lstatic:-bundle=native_dep_1")
17+
.arg("-llink-arg=some_flag")
18+
.arg("-lstatic:-bundle=native_dep_2")
19+
.crate_type("lib")
20+
.arg("-Zunstable-options")
21+
.run();
22+
rustc().input("rust_dep_attr.rs").crate_type("lib").run();
23+
24+
// Check sequence of linker arguments
25+
let out_flag = rustc()
26+
.input("main.rs")
27+
.extern_("lib", rust_lib_name("rust_dep_flag"))
28+
.crate_type("bin")
29+
.print("link-args")
30+
.run_unchecked()
31+
.stdout_utf8();
32+
let out_attr = rustc()
33+
.input("main.rs")
34+
.extern_("lib", rust_lib_name("rust_dep_attr"))
35+
.crate_type("bin")
36+
.print("link-args")
37+
.run_unchecked()
38+
.stdout_utf8();
39+
40+
let re = regex::Regex::new("native_dep_1.*some_flag.*native_dep_2").unwrap();
41+
assert!(re.is_match(&out_flag));
42+
assert!(re.is_match(&out_attr));
43+
}

0 commit comments

Comments
 (0)