summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs27
1 files changed, 19 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
index 8a4b1cccf..e6edc452c 100644
--- a/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/debuginfo/mod.rs
@@ -5,11 +5,8 @@ mod line_info;
mod object;
mod unwind;
-use crate::prelude::*;
-
use cranelift_codegen::ir::Endianness;
use cranelift_codegen::isa::TargetIsa;
-
use gimli::write::{
Address, AttributeValue, DwarfUnit, FileId, LineProgram, LineString, Range, RangeList,
UnitEntryId,
@@ -17,12 +14,13 @@ use gimli::write::{
use gimli::{Encoding, Format, LineEncoding, RunTimeEndian};
use indexmap::IndexSet;
-pub(crate) use emit::{DebugReloc, DebugRelocName};
-pub(crate) use unwind::UnwindContext;
+pub(crate) use self::emit::{DebugReloc, DebugRelocName};
+pub(crate) use self::unwind::UnwindContext;
+use crate::prelude::*;
pub(crate) fn producer() -> String {
format!(
- "cg_clif (rustc {}, cranelift {})",
+ "rustc version {} with cranelift {}",
rustc_interface::util::rustc_version_str().unwrap_or("unknown version"),
cranelift_codegen::VERSION,
)
@@ -33,6 +31,8 @@ pub(crate) struct DebugContext {
dwarf: DwarfUnit,
unit_range_list: RangeList,
+
+ should_remap_filepaths: bool,
}
pub(crate) struct FunctionDebugContext {
@@ -65,12 +65,18 @@ impl DebugContext {
let mut dwarf = DwarfUnit::new(encoding);
+ let should_remap_filepaths = tcx.sess.should_prefer_remapped_for_codegen();
+
let producer = producer();
let comp_dir = tcx
.sess
.opts
.working_dir
- .to_string_lossy(FileNameDisplayPreference::Remapped)
+ .to_string_lossy(if should_remap_filepaths {
+ FileNameDisplayPreference::Remapped
+ } else {
+ FileNameDisplayPreference::Local
+ })
.into_owned();
let (name, file_info) = match tcx.sess.local_crate_source_file() {
Some(path) => {
@@ -104,7 +110,12 @@ impl DebugContext {
root.set(gimli::DW_AT_low_pc, AttributeValue::Address(Address::Constant(0)));
}
- DebugContext { endian, dwarf, unit_range_list: RangeList(Vec::new()) }
+ DebugContext {
+ endian,
+ dwarf,
+ unit_range_list: RangeList(Vec::new()),
+ should_remap_filepaths,
+ }
}
pub(crate) fn define_function(