From c1e585c37caa8a5abe335eeba2e3cb835185f3a0 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Mon, 4 Jul 2022 22:33:38 +0800 Subject: [PATCH] xtask: ensure loader is build with lto,codegenunits=1 If the loader is not build with these two parameters, then Weird Things happen with the font table. Signed-off-by: Sean Cross --- xtask/src/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index d1390a5b7..dfe6308c4 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -876,6 +876,14 @@ fn build_hw_image( pkg_path.push(pkg); init.push(pkg_path); } + let existing_lto = std::env::var("CARGO_PROFILE_RELEASE_LTO") + .map(|v| Some(v)) + .unwrap_or(None); + let existing_codegen_units = std::env::var("CARGO_PROFILE_RELEASE_CODEGEN_UNITS") + .map(|v| Some(v)) + .unwrap_or(None); + std::env::set_var("CARGO_PROFILE_RELEASE_LTO", "true"); + std::env::set_var("CARGO_PROFILE_RELEASE_CODEGEN_UNITS", "1"); let mut loader = build( &["loader"], debug, @@ -884,6 +892,12 @@ fn build_hw_image( None, loader_features, )?; + if let Some(existing) = existing_lto { + std::env::set_var("CARGO_PROFILE_RELEASE_LTO", existing); + } + if let Some(existing) = existing_codegen_units { + std::env::set_var("CARGO_PROFILE_RELEASE_CODEGEN_UNITS", existing); + } loader.push(PathBuf::from("loader")); let output_bundle = create_image(&kernel, &init, debug, MemorySpec::SvdFile(svd_file))?;