Auto merge of #117962 - weihanglo:debug-name-table, r=wesleywiser
fix: stop emitting `.debug_pubnames` and `.debug_pubtypes` A continuation of #94181. Fixes #48762 MCP can be found in <https://github.com/rust-lang/compiler-team/issues/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 * https://github.com/rust-lang/rust/issues/48762 * https://rust-lang.zulipchat.com/#narrow/stream/317568-t-compiler.2Fwg-debugging/topic/investigating.20debuginfo.20size/near/342713604 * `DwarfCompileUnit::hasDwarfPubSections()` —f633f325a1/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (L1477-L1494)* clang default to no debug name table when no option provided —f633f325a1/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) —5d2a360f0a/gcc/target.def (L6985-L6990)and319b460545/gold/dwarf_reader.h (L424-L427)* Probably the only place that makes use of pub section in lldb —725115d7bb/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (L2117-L2135)* "The -gsplit-dwarf option requires -ggnu-pubnames." —5d2a360f0a/gcc/opts.cc (L1205)* LLVM: Always emit `.debug_names` with dwarf 5 for Apple platforms — https://reviews.llvm.org/D118754 </p> </details>
This commit is contained in:
commit
e2a3c9b3f0
5 changed files with 73 additions and 3 deletions
24
tests/assembly/dwarf4.rs
Normal file
24
tests/assembly/dwarf4.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// Makes sure that `-Z dwarf-version=4` causes `rustc` to emit DWARF version 4.
|
||||
// assembly-output: emit-asm
|
||||
// compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0
|
||||
// needs-llvm-components: x86
|
||||
|
||||
#![feature(no_core, lang_items)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
|
||||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
#[lang = "copy"]
|
||||
trait Copy {}
|
||||
|
||||
pub fn wibble() {}
|
||||
|
||||
pub struct X;
|
||||
|
||||
// CHECK: .section .debug_info
|
||||
// CHECK-NOT: .short 2
|
||||
// CHECK-NOT: .short 5
|
||||
// CHECK: .short 4
|
||||
// CHECK-NOT: .section .debug_pubnames
|
||||
// CHECK-NOT: .section .debug_pubtypes
|
||||
|
|
@ -18,3 +18,4 @@ pub fn wibble() {}
|
|||
// CHECK-NOT: .short 2
|
||||
// CHECK-NOT: .short 4
|
||||
// CHECK: .short 5
|
||||
// CHECK: .section .debug_names
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue