Skip to content

Commit 2136c50

Browse files
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.
1 parent c4b91bd commit 2136c50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/debuginfo.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ impl<'gcc, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
254254
// TODO(antoyo): implement.
255255
}
256256

257-
fn debuginfo_finalize(&self) {
257+
fn debuginfo_finalize(&mut self) {
258+
// TODO: emit section `.debug_gdb_scripts`.
258259
self.context.set_debug_info(true)
259260
}
260261

0 commit comments

Comments
 (0)