diff options
| author | bors <bors@rust-lang.org> | 2025-08-07 07:47:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-07 07:47:18 +0000 |
| commit | 9b1a30e5e69e1537ef6eb6eb829eb47075206dea (patch) | |
| tree | 58efd6d8f35080bb0eb736ba03bcde25608ad0a8 /compiler/rustc_codegen_llvm/src/debuginfo/mod.rs | |
| parent | 61cb1e97fcf954c37d0a457a8084ed9ad8b3cb82 (diff) | |
| parent | e02cc40ec96457ab563273a69d314418cea7eb84 (diff) | |
| download | rust-9b1a30e5e69e1537ef6eb6eb829eb47075206dea.tar.gz rust-9b1a30e5e69e1537ef6eb6eb829eb47075206dea.zip | |
Auto merge of #145014 - bjorn3:revert_preserve_debug_gdb_scripts, r=lqd
Revert "Preserve the .debug_gdb_scripts section" https://github.com/rust-lang/rust/pull/143679 introduces a significant build time perf regression for ripgrep. Let's revert it such that we can investigate it without pressure.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo/mod.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/mod.rs | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs index c911435967c..6cbf2dbf7d3 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs @@ -30,7 +30,7 @@ use tracing::debug; use self::metadata::{UNKNOWN_COLUMN_NUMBER, UNKNOWN_LINE_NUMBER, file_metadata, type_di_node}; use self::namespace::mangled_name_of_instance; -use self::utils::{DIB, create_DIArray, debug_context, is_node_local_to_unit}; +use self::utils::{DIB, create_DIArray, is_node_local_to_unit}; use crate::builder::Builder; use crate::common::{AsCCharPtr, CodegenCx}; use crate::llvm; @@ -131,28 +131,20 @@ impl<'ll, 'tcx> CodegenUnitDebugContext<'ll, 'tcx> { } /// Creates any deferred debug metadata nodes -pub(crate) fn finalize(cx: &mut CodegenCx<'_, '_>) { - if cx.dbg_cx.is_none() { - return; - } - - debug!("finalize"); - - if gdb::needs_gdb_debug_scripts_section(cx) { - // Add a .debug_gdb_scripts section to this compile-unit. This will - // cause GDB to try and load the gdb_load_rust_pretty_printers.py file, - // which activates the Rust pretty printers for binary this section is - // contained in. - let section_var = gdb::get_or_insert_gdb_debug_scripts_section_global(cx); +pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) { + if let Some(dbg_cx) = &cx.dbg_cx { + debug!("finalize"); + + if gdb::needs_gdb_debug_scripts_section(cx) { + // Add a .debug_gdb_scripts section to this compile-unit. This will + // cause GDB to try and load the gdb_load_rust_pretty_printers.py file, + // which activates the Rust pretty printers for binary this section is + // contained in. + gdb::get_or_insert_gdb_debug_scripts_section_global(cx); + } - // Make sure that the linker doesn't optimize the global away. Adding - // it to `llvm.used` has the advantage that it works even in no_std - // binaries, where we don't have a main shim and thus don't emit a - // volatile load to preserve the global. - cx.add_used_global(section_var); + dbg_cx.finalize(cx.sess()); } - - debug_context(cx).finalize(cx.sess()); } impl<'ll> Builder<'_, 'll, '_> { @@ -622,7 +614,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> { metadata::extend_scope_to_file(self, scope_metadata, file) } - fn debuginfo_finalize(&mut self) { + fn debuginfo_finalize(&self) { finalize(self) } |
