[Lldb-commits] [PATCH] D54747: Discard debuginfo for object files empty after GC

Robert O'Callahan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 28 23:17:37 PST 2018

rocallahan added a comment.

Sorry for the delayed reply. I just discovered that Phabricator nofications were being buried by my mail filters.

In D54747#1312161 <https://reviews.llvm.org/D54747#1312161>, @ruiu wrote:

> What you are doing in this patch is not too complicated and makes sense to me. That said, if actual size saving is not significant as you said in https://github.com/rust-lang/rust/issues/56068#issuecomment-440160568, it may not be worth doing. It seems to me that if debug info is already 2.4GB, shrinking it to 2GB doesn't make much difference.

17% saving for a pretty small and conservative patch seems good to me, but I guess it's subjective.

In D54747#1315241 <https://reviews.llvm.org/D54747#1315241>, @ruiu wrote:

> rocallahan, can I ask why Rust passes all object files to the linker and use `-gc-sections` to eliminate unused part of these files?

I'm not a Rust compiler contributor, but my guess is developer ergonomics. Once upon a time users manually divided code into translation units, each producing an object, file and garbage collection occurred only at the granularity of object files. Later `--gc-sections` and `-ffunction-sections` let compilers automatically subdivide object files into smaller units and GC with a granularity of functions. In Rust each translation unit is a whole module (crate); users aren't expected to subdivide libraries into smaller units for GC purposes, and in fact aren't able to. Emitting one section per function mostly means they don't need to ... except it breaks down with DWARF here.

> One possible way to fix it is to pass `--start-lib` to the linker before any object file paths in the command line. That option gives archive file semantics to object files, so if you option, each object file is treated as if that were in an archive file containing that the single object file. (Note that `--start-lib` is a positional option just like `--start-group`, so all files between `--start-lib` and `--end-lib` get that special treament.)

I will try that and follow up but I don't see how it would make any difference.

  rLLD LLVM Linker



More information about the lldb-commits mailing list