Translate the virtual /rustc/$hash prefix back to a real directory.

This commit is contained in:
Eduard-Mihai Burtescu
2020-04-01 04:00:52 +03:00
parent b793f403bd
commit f5892c00ac
6 changed files with 121 additions and 18 deletions

View File

@@ -740,19 +740,18 @@ impl Build {
self.config.jobs.unwrap_or_else(|| num_cpus::get() as u32)
}
fn debuginfo_map(&self, which: GitRepo) -> Option<String> {
fn debuginfo_map_to(&self, which: GitRepo) -> Option<String> {
if !self.config.rust_remap_debuginfo {
return None;
}
let path = match which {
match which {
GitRepo::Rustc => {
let sha = self.rust_sha().unwrap_or(channel::CFG_RELEASE_NUM);
format!("/rustc/{}", sha)
Some(format!("/rustc/{}", sha))
}
GitRepo::Llvm => String::from("/rustc/llvm"),
};
Some(format!("{}={}", self.src.display(), path))
GitRepo::Llvm => Some(String::from("/rustc/llvm")),
}
}
/// Returns the path to the C compiler for the target specified.
@@ -787,7 +786,8 @@ impl Build {
base.push("-fno-omit-frame-pointer".into());
}
if let Some(map) = self.debuginfo_map(which) {
if let Some(map_to) = self.debuginfo_map_to(which) {
let map = format!("{}={}", self.src.display(), map_to);
let cc = self.cc(target);
if cc.ends_with("clang") || cc.ends_with("gcc") {
base.push(format!("-fdebug-prefix-map={}", map));