File tree Expand file tree Collapse file tree 4 files changed +45
-14
lines changed
pass-linker-flags-from-dep Expand file tree Collapse file tree 4 files changed +45
-14
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,6 @@ run-make/optimization-remarks-dir-pgo/Makefile
106106run-make/optimization-remarks-dir/Makefile
107107run-make/output-type-permutations/Makefile
108108run-make/panic-abort-eh_frame/Makefile
109- run-make/pass-linker-flags-from-dep/Makefile
110109run-make/pass-non-c-like-enum-to-c/Makefile
111110run-make/pdb-buildinfo-cl-cmd/Makefile
112111run-make/pgo-gen-lto/Makefile
Original file line number Diff line number Diff line change 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
910use run_make_support:: { regex, rustc} ;
1011
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments