From e5796c46de20856f2eee0d8651572343d4fea9db Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Sun, 5 Dec 2021 20:49:23 +0000 Subject: Apply path remapping to DW_AT_GNU_dwo_name --- compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_codegen_llvm/src/debuginfo') diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index 10c7bb2eaea..f15f81a83b0 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1057,9 +1057,12 @@ pub fn compile_unit_metadata( let output_filenames = tcx.output_filenames(()); let out_dir = &output_filenames.out_directory; let split_name = if tcx.sess.target_can_use_split_dwarf() { - output_filenames - .split_dwarf_path(tcx.sess.split_debuginfo(), Some(codegen_unit_name)) - .map(|f| out_dir.join(f)) + output_filenames.split_dwarf_path(tcx.sess.split_debuginfo(), Some(codegen_unit_name)).map( + |f| { + let joined = out_dir.join(f); + tcx.sess.source_map().path_mapping().map_prefix(joined).0 + }, + ) } else { None } -- cgit 1.4.1-3-g733a5 From 42190bb42e06f87e24f9b4280a996175e97b73ab Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Mon, 6 Dec 2021 23:59:59 +0000 Subject: Remove redundant path join --- compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'compiler/rustc_codegen_llvm/src/debuginfo') diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index f15f81a83b0..0549bf853b9 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1055,14 +1055,11 @@ pub fn compile_unit_metadata( let work_dir = tcx.sess.opts.working_dir.to_string_lossy(FileNameDisplayPreference::Remapped); let flags = "\0"; let output_filenames = tcx.output_filenames(()); - let out_dir = &output_filenames.out_directory; let split_name = if tcx.sess.target_can_use_split_dwarf() { - output_filenames.split_dwarf_path(tcx.sess.split_debuginfo(), Some(codegen_unit_name)).map( - |f| { - let joined = out_dir.join(f); - tcx.sess.source_map().path_mapping().map_prefix(joined).0 - }, - ) + output_filenames + .split_dwarf_path(tcx.sess.split_debuginfo(), Some(codegen_unit_name)) + // We get a path relative to the working directory from split_dwarf_path + .map(|f| tcx.sess.source_map().path_mapping().map_prefix(f).0) } else { None } -- cgit 1.4.1-3-g733a5