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 45b50d3

Browse files
committedMay 14, 2024
lto function, static_library call, rename
1 parent 71fd2cf commit 45b50d3

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed
 

‎src/tools/run-make-support/src/rustc.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,9 @@ impl Rustc {
150150
self
151151
}
152152

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");
157156
self
158157
}
159158

‎tests/run-make/issue-14500/rmake.rs ‎tests/run-make/reachable-extern-fn-available-lto/rmake.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// 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.
33

44
// In this test, the `foo` crate has a reahable symbol,
55
// and is a dependency of the `bar` crate. When the `bar` crate
@@ -9,15 +9,15 @@
99

1010
//@ ignore-cross-compile
1111

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};
1313

1414
fn main() {
15-
let libbar_path = tmp_dir().join("libbar.a");
15+
let libbar_path = static_lib("bar");
1616
rustc().input("foo.rs").crate_type("rlib").run();
1717
rustc()
1818
.input("bar.rs")
1919
.crate_type("staticlib")
20-
.codegen_option("lto")
20+
.lto()
2121
.library_search_path(".")
2222
.output(&libbar_path)
2323
.run();

0 commit comments

Comments
 (0)
Failed to load comments.