4 files changed +45
-16
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,20 @@ impl Rustc {
150
150
self
151
151
}
152
152
153
+ /// Pass a codegen option.
154
+ pub fn codegen_option ( & mut self , option : & str ) -> & mut Self {
155
+ self . cmd . arg ( "-C" ) ;
156
+ self . cmd . arg ( option) ;
157
+ self
158
+ }
159
+
160
+ /// Add a directory to the library search path.
161
+ pub fn library_search_path < P : AsRef < Path > > ( & mut self , path : P ) -> & mut Self {
162
+ self . cmd . arg ( "-L" ) ;
163
+ self . cmd . arg ( path. as_ref ( ) ) ;
164
+ self
165
+ }
166
+
153
167
/// Specify the edition year.
154
168
pub fn edition ( & mut self , edition : & str ) -> & mut Self {
155
169
self . cmd . arg ( "--edition" ) ;
Original file line number Diff line number Diff line change @@ -99,7 +99,6 @@ run-make/issue-107094/Makefile
99
99
run-make/issue-10971-temps-dir/Makefile
100
100
run-make/issue-109934-lto-debuginfo/Makefile
101
101
run-make/issue-11908/Makefile
102
- run-make/issue-14500/Makefile
103
102
run-make/issue-14698/Makefile
104
103
run-make/issue-15460/Makefile
105
104
run-make/issue-18943/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // Test to make sure that reachable extern fns are always available in final
2
+ // productcs, including when LTO is used.
3
+
4
+ // In this test, the `foo` crate has a reahable symbol,
5
+ // and is a dependency of the `bar` crate. When the `bar` crate
6
+ // is compiled with LTO, it shouldn't strip the symbol from `foo`, and that's the
7
+ // only way that `foo.c` will successfully compile.
8
+ // See https://github.com/rust-lang/rust/issues/14500
9
+
10
+ //@ ignore-cross-compile
11
+
12
+ use run_make_support:: { cc, extra_c_flags, run, rustc} ;
13
+
14
+ fn main ( ) {
15
+ let libbar_path = tmp_dir ( ) . join ( "libbar.a" ) ;
16
+ rustc ( ) . input ( "foo.rs" )
17
+ . crate_type ( "rlib" )
18
+ . run ( ) ;
19
+ rustc ( ) . input ( "bar.rs" )
20
+ . static_lib ( "staticlib" )
21
+ . codegen_option ( "lto" )
22
+ . library_search_path ( "." )
23
+ . output ( & libbar_path)
24
+ . run ( ) ;
25
+ cc ( ) . input ( "foo.c" )
26
+ . input ( libbar_path)
27
+ . args ( & extra_c_flags ( ) )
28
+ . out_exe ( "foo" )
29
+ . run ( ) ;
30
+ run ( "foo" ) ;
31
+ }
0 commit comments