Commit e2a3c9b
committed
Auto merge of rust-lang#117962 - weihanglo:debug-name-table, r=wesleywiser
fix: stop emitting `.debug_pubnames` and `.debug_pubtypes`
A continuation of rust-lang#94181.
Fixes rust-lang#48762
MCP can be found in <rust-lang/compiler-team#688>.
`.debug_pubnames` and `.debug_pubtypes` are poorly designed and people
seldom use them. However, they take a considerable portion of size in
the final binary. This tells LLVM stop emitting those sections on
DWARFv4 or lower. DWARFv5 use `.debug_names` which is more concise
in size and performant for name lookup.
Some other no-really-useful personal notes:
<details><summary>Details</summary>
<p>
## Pepole saying they are not useful
* rust-lang#48762
* https://rust-lang.zulipchat.com/#narrow/stream/317568-t-compiler.2Fwg-debugging/topic/investigating.20debuginfo.20size/near/342713604
* `DwarfCompileUnit::hasDwarfPubSections()` — https://github.com/llvm/llvm-project/blob/f633f325a1b808d33ca9653ed373353549ddcde6/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp#L1477-L1494
* clang default to no debug name table when no option provided — https://github.com/llvm/llvm-project/blob/f633f325a1b808d33ca9653ed373353549ddcde6/clang/lib/Frontend/CompilerInvocation.cpp#L1819-L1824
* GCC explicitly says GDB doesn't use pub sections (`TARGET_WANT_DEBUG_PUB_SECTIONS` only be true on Darwin) — https://github.com/gcc-mirror/gcc/blob/5d2a360f0a541646abb11efdbabc33c6a04de7ee/gcc/target.def#L6985-L6990 and https://github.com/bminor/binutils-gdb/blob/319b460545dc79280e2904dcc280057cf71fb753/gold/dwarf_reader.h#L424-L427
* Probably the only place that makes use of pub section in lldb — https://github.com/llvm/llvm-project/blob/725115d7bba2faf3d0c21442f4661dea77b8a77c/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L2117-L2135
* "The -gsplit-dwarf option requires -ggnu-pubnames." — https://github.com/gcc-mirror/gcc/blob/5d2a360f0a541646abb11efdbabc33c6a04de7ee/gcc/opts.cc#L1205
* LLVM: Always emit `.debug_names` with dwarf 5 for Apple platforms — https://reviews.llvm.org/D118754
</p>
</details>File tree
5 files changed
+73
-3
lines changed- compiler
- rustc_codegen_llvm/src
- debuginfo
- llvm
- rustc_llvm/llvm-wrapper
- tests/assembly
5 files changed
+73
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
878 | 880 | | |
879 | 881 | | |
880 | 882 | | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
881 | 894 | | |
882 | 895 | | |
883 | 896 | | |
| |||
907 | 920 | | |
908 | 921 | | |
909 | 922 | | |
| 923 | + | |
910 | 924 | | |
911 | 925 | | |
912 | 926 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
797 | 806 | | |
798 | 807 | | |
799 | 808 | | |
| |||
1812 | 1821 | | |
1813 | 1822 | | |
1814 | 1823 | | |
| 1824 | + | |
1815 | 1825 | | |
1816 | 1826 | | |
1817 | 1827 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
700 | 719 | | |
701 | 720 | | |
702 | 721 | | |
| |||
765 | 784 | | |
766 | 785 | | |
767 | 786 | | |
768 | | - | |
| 787 | + | |
| 788 | + | |
769 | 789 | | |
770 | 790 | | |
771 | 791 | | |
772 | 792 | | |
773 | 793 | | |
774 | | - | |
| 794 | + | |
| 795 | + | |
775 | 796 | | |
776 | 797 | | |
777 | 798 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
0 commit comments