Commit 5eeeed1
committed
Greatly decrease the size of
- Only add -gz if it's supported
- Don't include extra unnecessary debuginfo when only debuginfo-level=1 is set
- Compress debuginfo sections to reduce the size of debuginfo on disk.
before: 650 MB
line tables only: 335 MB
compressed only: 216 MB
compressed and line tables: 186 MB
no debuginfo at all: 130 MB
I want to investigate why `-C line-tables-only` is still ~tripling the
size of the binary, but this seems like a good improvement in the
meantime.
I've tested that both valgrind and perf can read the debuginfo:
```
(bash@dev-desktop-us-1.infra.rust-lang.org) ~/rust [08:31:08]
; valgrind $(rustup which rustc --toolchain rust_stage2) --version
==441671== Memcheck, a memory error detector
==441671== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==441671== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==441671== Command: /home/gh-jyn514/.local/lib/rustup/toolchains/rust_stage2/bin/rustc --version
==441671==
rustc 1.70.0-dev
==441671==
==441671== HEAP SUMMARY:
==441671== in use at exit: 231,289 bytes in 1,874 blocks
==441671== total heap usage: 2,538 allocs, 664 frees, 486,368 bytes allocated
==441671==
==441671== LEAK SUMMARY:
==441671== definitely lost: 70,656 bytes in 1 blocks
==441671== indirectly lost: 0 bytes in 0 blocks
==441671== possibly lost: 0 bytes in 0 blocks
==441671== still reachable: 160,633 bytes in 1,873 blocks
==441671== suppressed: 0 bytes in 0 blocks
==441671== Rerun with --leak-check=full to see details of leaked memory
==441671==
==441671== For lists of detected and suppressed errors, rerun with: -s
==441671== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
; perf record $(rustup which rustc --toolchain rust_stage2) --version
rustc 1.70.0-dev
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.005 MB perf.data (70 samples) ]
; perf report
Samples: 70 of event 'cycles:u', Event count (approx.): 21356967
Overhead Command Shared Object Symbol
51.55% rustc ld-linux-aarch64.so.1 [.] _dl_lookup_symbol_x
18.70% rustc ld-linux-aarch64.so.1 [.] _dl_relocate_object
11.95% rustc ld-linux-aarch64.so.1 [.] do_lookup_x
5.55% rustc [unknown] [k] 0xffffa9ad41cfcfdc
2.68% rustc libc.so.6 [.] __GI___strlen_asimd
2.42% rustc librustc_driver-1a385c366c35e81a.so [.] llvm::StringMapImpl::LookupBucketFor
2.16% rustc librustc_driver-1a385c366c35e81a.so [.] _GLOBAL__sub_I_X86InstructionSelector.cpp
1.96% rustc libstd-990fe978dab76ef3.so [.] <alloc::vec::Vec<T,A> as core::clone::Clone>::clone
1.60% rustc librustc_driver-1a385c366c35e81a.so [.] llvm::cl::opt<bool, false, llvm::cl::parser<bool> >::~opt
1.22% rustc ld-linux-aarch64.so.1 [.] strcmp
0.13% rustc ld-linux-aarch64.so.1 [.] stat64
0.05% rustc ld-linux-aarch64.so.1 [.] __minimal_calloc
0.02% rustc ld-linux-aarch64.so.1 [.] __GI___tunables_init
0.02% rustc ld-linux-aarch64.so.1 [.] _dl_start
0.00% rustc [unknown] [k] 0xffffa9ad41cfd844
0.00% rustc ld-linux-aarch64.so.1 [.] _start
```rustc_driver.so when debuginfo is enabled1 parent e4f7ad8 commit 5eeeed1
2 files changed
+11
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1673 | 1673 | | |
1674 | 1674 | | |
1675 | 1675 | | |
1676 | | - | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
1677 | 1685 | | |
1678 | 1686 | | |
1679 | 1687 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
0 commit comments