lto function, static_library call, rename · rust-lang/rust@45b50d3 (original) (raw)

File tree

5 files changed

lines changed

5 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -150,10 +150,9 @@ 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);
153 +/// Enables link time optimizations in rustc. Equivalent to `-Clto``.
154 + pub fn lto(&mut self) -> &mut Self {
155 +self.cmd.arg("-Clto");
157 156 self
158 157 }
159 158

File renamed without changes.

File renamed without changes.

File renamed without changes.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1 1 // Test to make sure that reachable extern fns are always available in final
2 -// productcs, including when LTO is used.
2 +// productcs, including when link time optimizations (LTO) are used.
3 3
4 4 // In this test, the `foo` crate has a reahable symbol,
5 5 // and is a dependency of the `bar` crate. When the `bar` crate
@@ -9,15 +9,15 @@
9 9
10 10 //@ ignore-cross-compile
11 11
12 -use run_make_support::{cc, extra_c_flags, run, rustc, tmp_dir};
12 +use run_make_support::{cc, extra_c_flags, run, rustc, static_lib, tmp_dir};
13 13
14 14 fn main() {
15 -let libbar_path = tmp_dir().join("libbar.a");
15 +let libbar_path = static_lib("bar");
16 16 rustc().input("foo.rs").crate_type("rlib").run();
17 17 rustc()
18 18 .input("bar.rs")
19 19 .crate_type("staticlib")
20 -.codegen_option("lto")
20 +.lto()
21 21 .library_search_path(".")
22 22 .output(&libbar_path)
23 23 .run();