about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src
diff options
context:
space:
mode:
authorSebastian Poeplau <poeplau@adacore.com>2025-08-01 12:39:50 +0200
committerSebastian Poeplau <poeplau@adacore.com>2025-08-05 10:55:07 +0200
commit868bdde25b030e0b71a29a5dbc04a891036e702e (patch)
tree4fdbccbcc0f1760014fba2ae3e771f76bb065c04 /compiler/rustc_codegen_gcc/src
parent0f353363965ebf05e0757f7679c800b39c51a07e (diff)
downloadrust-868bdde25b030e0b71a29a5dbc04a891036e702e.tar.gz
rust-868bdde25b030e0b71a29a5dbc04a891036e702e.zip
Preserve the .debug_gdb_scripts section
Make sure that compiler and linker don't optimize the section's contents
away by adding the global holding the data to "llvm.used". The volatile
load in the main shim is retained because "llvm.used", which translates
to SHF_GNU_RETAIN on ELF targets, requires a reasonably recent linker;
emitting the volatile load ensures compatibility with older linkers, at
least when libstd is used.

Pretty printers in dylib dependencies are now emitted by the main crate
instead of the dylib; apart from matching how rlibs are handled, this
approach has the advantage that `omit_gdb_pretty_printer_section` keeps
working with dylib dependencies.
Diffstat (limited to 'compiler/rustc_codegen_gcc/src')
-rw-r--r--compiler/rustc_codegen_gcc/src/debuginfo.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_gcc/src/debuginfo.rs b/compiler/rustc_codegen_gcc/src/debuginfo.rs
index 4c8585192a1..4c0b6439523 100644
--- a/compiler/rustc_codegen_gcc/src/debuginfo.rs
+++ b/compiler/rustc_codegen_gcc/src/debuginfo.rs
@@ -254,7 +254,8 @@ impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
         // TODO(antoyo): implement.
     }
 
-    fn debuginfo_finalize(&self) {
+    fn debuginfo_finalize(&mut self) {
+        // TODO: emit section `.debug_gdb_scripts`.
         self.context.set_debug_info(true)
     }