[PATCH] D74169: [WIP][LLD][ELF][DebugInfo] Remove obsolete debug info.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 10:13:46 PDT 2020


dblaikie added a comment.

In D74169#1990180 <https://reviews.llvm.org/D74169#1990180>, @benesch wrote:

> Just an excited observer, but wanted to drop some statistics of my own, in case they're helpful.
>
> I have a Rust project (Materialize <http://github.com/MaterializeInc/materialize>) that compiles down into a ~800MB (!) binary by default. The weight is almost entirely debug info; .text is less than 5% of its size. This is evidently an artifact of how Rust codegen units are much, much larger than your average C/C++ codegen units and so the toolchain relies heavily on the linker for dead code elimination.


Out of curiosity is there any work in the direction of fragmenting these modules/objects further to reduce this & other negative side effects of that situation?

>   Of course that dead code elimination doesn't currently apply to the debug info. This diff is exactly what's needed to solve the problem, as far as I can tell. (There's an upstream issue about this that led me here: https://github.com/rust-lang/rust/issues/56068.)
>    
> 
> Without `--gc-debuginfo`:
> 
>   # Link time: 10.486s
>   benesch at gibbon:~/materialize$ bloaty target/release/materialized -n 10
>       FILE SIZE        VM SIZE    
>    --------------  -------------- 
>     24.5%   194Mi   0.0%       0    .debug_info
>     24.1%   191Mi   0.0%       0    .debug_loc
>     13.8%   109Mi   0.0%       0    .debug_pubtypes
>     10.1%  79.9Mi   0.0%       0    .debug_pubnames
>      8.8%  70.0Mi   0.0%       0    .debug_str
>      8.3%  66.3Mi   0.0%       0    .debug_ranges
>      4.4%  35.3Mi   0.0%       0    .debug_line
>      3.1%  24.8Mi  66.3%  24.8Mi    .text
>      1.8%  14.4Mi  25.1%  9.39Mi    [41 Others]
>      0.6%  4.79Mi   0.0%       0    .strtab
>      0.4%  3.22Mi   8.6%  3.22Mi    .eh_frame
>    100.0%   793Mi 100.0%  37.4Mi    TOTAL
> 
> 
> With `--gc-debuginfo`:
> 
>   # Link time: 249.855s
>   benesch at gibbon:~/materialize$ bloaty target/release/materialized -n 10
>       FILE SIZE        VM SIZE    
>    --------------  -------------- 
>     37.9%   115Mi   0.0%       0    .debug_info
>     17.9%  54.7Mi   0.0%       0    .debug_str
>     12.0%  36.7Mi   0.0%       0    .debug_ranges
>     11.2%  34.4Mi   0.0%       0    .debug_loc
>      8.1%  24.8Mi  66.3%  24.8Mi    .text
>      6.6%  20.1Mi   0.0%       0    .debug_line
>      2.7%  8.15Mi  19.3%  7.23Mi    [35 Others]
>      1.6%  4.79Mi   0.0%       0    .strtab
>      1.1%  3.22Mi   8.6%  3.22Mi    .eh_frame
>      1.0%  2.99Mi   0.0%       0    .symtab
>      0.0%       0   5.8%  2.16Mi    .bss
>    100.0%   305Mi 100.0%  37.4Mi    TOTAL
> 
> 
> So hugely successful in reducing the size of the debug info! The new binary is 40% of the size of the original. Some of that savings is from omitting `debug_pubtypes` and `debug_pubnames`, which is easy enough to strip without this patch, but there is also a substantial reduction in `debug_info` and `debug_loc`—a much larger reduction than `dbz` is able to provide.
> 
> Unfortunately there is also a massive blowup in link times, from 10s to 250s. That's a 25x increase, much larger than the link time increase for Clang described above, which was about 4x.




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74169/new/

https://reviews.llvm.org/D74169





More information about the llvm-commits mailing list