-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
do not emit .debug_pubnames .debug_pubtypes on Linux #94181
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
I have no idea whether this option should exist or not, and what default value it should have, so I only left some generic comments. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The job Click to see the possible cause of the failure (guessed by this bot)
|
☔ The latest upstream changes (presumably #97239) made this pull request unmergeable. Please resolve the merge conflicts. |
[EXPERIMENT] fix: stop `emitting .debug_pubnames` and `.debug_pubtypes` ### DO NOT MERGE --- 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.
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>
…wiser 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>
Cherry-pick from @tromey
Closes #48762