diff --git a/build_system/bench.rs b/build_system/bench.rs index 1e83f21ba57..01d44dafbdd 100644 --- a/build_system/bench.rs +++ b/build_system/bench.rs @@ -4,7 +4,7 @@ use super::path::{Dirs, RelPath}; use super::prepare::GitRepo; -use super::rustc_info::{get_file_name, get_wrapper_file_name}; +use super::rustc_info::get_file_name; use super::utils::{hyperfine_command, is_ci, spawn_and_wait, CargoProject, Compiler}; pub(crate) static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github( @@ -51,7 +51,8 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) { .unwrap(); eprintln!("[BENCH COMPILE] ebobby/simple-raytracer"); - let cargo_clif = RelPath::DIST.to_path(dirs).join(get_wrapper_file_name("cargo-clif", "bin")); + let cargo_clif = + RelPath::DIST.to_path(dirs).join(get_file_name("cargo_clif", "bin").replace('_', "-")); let manifest_path = SIMPLE_RAYTRACER.manifest_path(dirs); let target_dir = SIMPLE_RAYTRACER.target_dir(dirs); diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index d3bc7ec0128..cbc58365e69 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -3,9 +3,7 @@ use std::process::{self, Command}; use super::path::{Dirs, RelPath}; -use super::rustc_info::{ - get_file_name, get_rustc_version, get_toolchain_name, get_wrapper_file_name, -}; +use super::rustc_info::{get_cargo_path, get_file_name, get_rustc_version, get_toolchain_name}; use super::utils::{spawn_and_wait, try_hard_link, CargoProject, Compiler}; use super::SysrootKind; @@ -42,8 +40,9 @@ pub(crate) fn build_sysroot( try_hard_link(cg_clif_dylib_src, &cg_clif_dylib_path); // Build and copy rustc and cargo wrappers + let wrapper_base_name = get_file_name("____", "bin"); for wrapper in ["rustc-clif", "rustdoc-clif", "cargo-clif"] { - let wrapper_name = get_wrapper_file_name(wrapper, "bin"); + let wrapper_name = wrapper_base_name.replace("____", wrapper); let mut build_cargo_wrapper_cmd = Command::new(&bootstrap_host_compiler.rustc); build_cargo_wrapper_cmd @@ -51,7 +50,7 @@ pub(crate) fn build_sysroot( .arg(RelPath::SCRIPTS.to_path(dirs).join(&format!("{wrapper}.rs"))) .arg("-o") .arg(DIST_DIR.to_path(dirs).join(wrapper_name)) - .arg("-g"); + .arg("-Cstrip=debuginfo"); spawn_and_wait(build_cargo_wrapper_cmd); } @@ -89,7 +88,23 @@ pub(crate) fn build_sysroot( } } - let mut target_compiler = Compiler::clif_with_triple(&dirs, target_triple); + let mut target_compiler = { + let dirs: &Dirs = &dirs; + let rustc_clif = + RelPath::DIST.to_path(&dirs).join(wrapper_base_name.replace("____", "rustc-clif")); + let rustdoc_clif = + RelPath::DIST.to_path(&dirs).join(wrapper_base_name.replace("____", "rustdoc-clif")); + + Compiler { + cargo: get_cargo_path(), + rustc: rustc_clif.clone(), + rustdoc: rustdoc_clif.clone(), + rustflags: String::new(), + rustdocflags: String::new(), + triple: target_triple, + runner: vec![], + } + }; if !is_native { target_compiler.set_cross_linker_and_runner(); } diff --git a/build_system/rustc_info.rs b/build_system/rustc_info.rs index 8a7e1c472dd..a70453b4422 100644 --- a/build_system/rustc_info.rs +++ b/build_system/rustc_info.rs @@ -93,12 +93,3 @@ pub(crate) fn get_file_name(crate_name: &str, crate_type: &str) -> String { assert!(file_name.contains(crate_name)); file_name } - -/// Similar to `get_file_name`, but converts any dashes (`-`) in the `crate_name` to -/// underscores (`_`). This is specially made for the rustc and cargo wrappers -/// which have a dash in the name, and that is not allowed in a crate name. -pub(crate) fn get_wrapper_file_name(crate_name: &str, crate_type: &str) -> String { - let crate_name = crate_name.replace('-', "_"); - let wrapper_name = get_file_name(&crate_name, crate_type); - wrapper_name.replace('_', "-") -} diff --git a/build_system/utils.rs b/build_system/utils.rs index 07ea482fbbe..21bfb1b1f00 100644 --- a/build_system/utils.rs +++ b/build_system/utils.rs @@ -5,7 +5,7 @@ use std::process::{self, Command, Stdio}; use super::path::{Dirs, RelPath}; -use super::rustc_info::{get_cargo_path, get_rustc_path, get_rustdoc_path, get_wrapper_file_name}; +use super::rustc_info::{get_cargo_path, get_rustc_path, get_rustdoc_path}; #[derive(Clone, Debug)] pub(crate) struct Compiler { @@ -31,23 +31,6 @@ pub(crate) fn bootstrap_with_triple(triple: String) -> Compiler { } } - pub(crate) fn clif_with_triple(dirs: &Dirs, triple: String) -> Compiler { - let rustc_clif = - RelPath::DIST.to_path(&dirs).join(get_wrapper_file_name("rustc-clif", "bin")); - let rustdoc_clif = - RelPath::DIST.to_path(&dirs).join(get_wrapper_file_name("rustdoc-clif", "bin")); - - Compiler { - cargo: get_cargo_path(), - rustc: rustc_clif.clone(), - rustdoc: rustdoc_clif.clone(), - rustflags: String::new(), - rustdocflags: String::new(), - triple, - runner: vec![], - } - } - pub(crate) fn set_cross_linker_and_runner(&mut self) { match self.triple.as_str() { "aarch64-unknown-linux-gnu" => {