[clang] [clang][DebugInfo] Set linkage name for dynamic initializer/destructor debug info (PR #189794)

Haohai Wen via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 06:00:10 PDT 2026


HaohaiWen wrote:

> > > Does `linkageName:` currently affect the debug info emitted by CodeView? If not, how will CodeViewDebug determine which functions should use `name:` and which should use `linkageName:`?
> > 
> > 
> > I think no. linkage name is not used by CodeView. CodeView uses "qualified name". The story is. On windows, pseudo probe is another kind of anchor for sampling based PGO. For some reason, pseudo probe uses linkage name (or name from subprogram) to generate GUID for each function.
> > https://github.com/llvm/llvm-project/blob/27769d7b5976c40f43f535ef19bcc6f8603fc3f6/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp#L347-L353
> > 
> > If two functions have same GUID but different body. It will crash currently.
> > This PR aims to fix that bug.
> > I think this PR will also affect -gdwarf on Windows.
> 
> In that case, LinkageName could be assigned to DISubprograms in question iff DISubprogram `name` is actually different from function name, to minimize DWARF change. Something like that:
> 
> ```c++
> if (Name != Fn->getName())
>     LinkageName = Fn->getName();
> ```
> 
> Will that work for PGO use-case?

Yes for PGO case.
My concern is that shouldn't we set linkage name properly even if it may not be encoded into the final binary. 

https://github.com/llvm/llvm-project/pull/189794


More information about the cfe-commits mailing list