Incorrect debug info for no_mangle
statics on Windows
#98295
Labels
A-debuginfo
Area: Debugging information in compiled programs (DWARF, PDB, etc.)
C-bug
Category: This is a bug.
O-windows-msvc
Toolchain: MSVC, Operating system: Windows
As a part of #97085 which is itself a fix for #33172, @wesleywiser and I discovered that LLVM seems to be producing the incorrect debug information for
no_mangle
statics on Windows.For the following code:
The correct debug information should not include a namespace. but it does:
Here's the relevant LLVM IR which at least looks correct:
This seems to be caused by an issue in LLVM which incorrectly walks the namespace hierarchy when building up statics.
Of particular suspicion is the following code in LVVM which seems to be switching on whether the code in question is fortran or not. The relevant code path for DWARF does not have such logic.
https://github.com/rust-lang/llvm-project/blob/2ed29d87efbe8a440fed6d171d4e33851fbb1c59/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp#L3279-L3283
In order to fix this, we need to understand the logic inside of
getFullyQualifiedName
and whether we can bail out early in the case of building a qualified name for ano_mangle
binding.The text was updated successfully, but these errors were encountered: