diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-12-18 14:49:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-18 14:49:38 +0100 |
| commit | 1c42199c8f62a4b4df6c71a047b28d1cbb075c7f (patch) | |
| tree | caf29580777bb9efb0c9200a8ab92029cd682555 /compiler/rustc_codegen_llvm/src | |
| parent | d3f300477b89e70dd42379ba53c0e8ff74e9c694 (diff) | |
| parent | 5e481d07d2f962cda0bdb76a1e6c19d99c1be847 (diff) | |
| download | rust-1c42199c8f62a4b4df6c71a047b28d1cbb075c7f.tar.gz rust-1c42199c8f62a4b4df6c71a047b28d1cbb075c7f.zip | |
Rollup merge of #91566 - cbeuw:remap-dwo-name, r=davidtwco
Apply path remapping to DW_AT_GNU_dwo_name when producing split DWARF `--remap-path-prefix` doesn't apply to paths to `.o` (in case of packed) or `.dwo` (in case of unpacked) files in `DW_AT_GNU_dwo_name`. GCC also has this bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91888
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/write.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 3fceb2ac4ed..224fcb66df8 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -205,8 +205,11 @@ pub fn target_machine_factory( let use_init_array = !sess.opts.debugging_opts.use_ctors_section.unwrap_or(sess.target.use_ctors_section); + let path_mapping = sess.source_map().path_mapping().clone(); + Arc::new(move |config: TargetMachineFactoryConfig| { - let split_dwarf_file = config.split_dwarf_file.unwrap_or_default(); + let split_dwarf_file = + path_mapping.map_prefix(config.split_dwarf_file.unwrap_or_default()).0; let split_dwarf_file = CString::new(split_dwarf_file.to_str().unwrap()).unwrap(); let tm = unsafe { diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index cc39332d198..c2d4621661f 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1055,11 +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| out_dir.join(f)) + // 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 } |
