Skip to content

Commit

Permalink
lto function, static_library call, rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed May 14, 2024
1 parent 71fd2cf commit 45b50d3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/tools/run-make-support/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,9 @@ impl Rustc {
self
}

/// Pass a codegen option.
pub fn codegen_option(&mut self, option: &str) -> &mut Self {
self.cmd.arg("-C");
self.cmd.arg(option);
/// Enables link time optimizations in rustc. Equivalent to `-Clto``.
pub fn lto(&mut self) -> &mut Self {
self.cmd.arg("-Clto");
self
}

Expand Down
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 @@
// Test to make sure that reachable extern fns are always available in final
// productcs, including when LTO is used.
// productcs, including when link time optimizations (LTO) are used.

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

//@ ignore-cross-compile

use run_make_support::{cc, extra_c_flags, run, rustc, tmp_dir};
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib, tmp_dir};

fn main() {
let libbar_path = tmp_dir().join("libbar.a");
let libbar_path = static_lib("bar");
rustc().input("foo.rs").crate_type("rlib").run();
rustc()
.input("bar.rs")
.crate_type("staticlib")
.codegen_option("lto")
.lto()
.library_search_path(".")
.output(&libbar_path)
.run();
Expand Down

0 comments on commit 45b50d3

Please sign in to comment.