Skip to content

Commit aff02df

Browse files
committed
build.rs: Disable LTO if enabled implictly
LTO between Rust and C is complicated. It requires clang and specific invocations configurations for both Rust and C compilations. If the CFLAGS from the environment enable LTO, for example from distribution build tools this can lead to errors. Instead always disable LTO for the C compilation. There is not much to optimize away anyways. Closes briansmith#1444
1 parent dcc7784 commit aff02df

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,8 @@ fn configure_cc(c: &mut cc::Build, target: &Target, c_root_dir: &Path, include_d
597597
if target.force_warnings_into_errors {
598598
c.warnings_into_errors(true);
599599
}
600+
601+
c.flag_if_supported("-fno-lto");
600602
}
601603

602604
fn nasm(file: &Path, arch: &str, include_dir: &Path, out_dir: &Path, c_root_dir: &Path) {

0 commit comments

Comments
 (0)