Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debuginfo: Don't emit DW_LANG_RUST unless it's explicitly demanded #33097

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"dump MIR state at various points in translation"),
orbit: bool = (false, parse_bool,
"get MIR where it belongs - everywhere; most importantly, in orbit"),
rust_debuginfo: bool = (false, parse_bool,
"emit Rust-specific debuginfo instead of fallback encoding"),
}

pub fn default_lib_output() -> CrateType {
Expand Down
11 changes: 10 additions & 1 deletion src/librustc_trans/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ use syntax::parse::token;
// From DWARF 5.
// See http://www.dwarfstd.org/ShowIssue.php?issue=140129.1
const DW_LANG_RUST: c_uint = 0x1c;
const DW_LANG_UNKNOWN: c_uint = 0x0;

#[allow(non_upper_case_globals)]
const DW_ATE_boolean: c_uint = 0x02;
#[allow(non_upper_case_globals)]
Expand Down Expand Up @@ -1013,10 +1015,17 @@ pub fn compile_unit_metadata(cx: &CrateContext) -> DIDescriptor {
let producer = CString::new(producer).unwrap();
let flags = "\0";
let split_name = "\0";

let language = if cx.sess().opts.debugging_opts.rust_debuginfo {
DW_LANG_RUST
} else {
DW_LANG_UNKNOWN
};

return unsafe {
llvm::LLVMDIBuilderCreateCompileUnit(
debug_context(cx).builder,
DW_LANG_RUST,
language,
compile_unit_name,
work_dir.as_ptr(),
producer.as_ptr(),
Expand Down