[llvm] [DwarfDebug] Associate subprogram DIEs with their Functions (PR #162852)

Vladislav Dzhidzhoev via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 11 09:31:05 PDT 2025


dzhidzhoev wrote:

> This example can be modified to prevent function merge: if unique-type1.cpp is compiled with -O0 (for any reason), and unique-type2.cpp is compiled with -O2, function merge doesn't happen, and in the resulting binary we have:
> 
> ```shell
> $ clang -flto=full unique-type1.bc unique-type2.bc -g -o unique-type.dylib -dynamiclib -fstandalone-debug -v
> $ objdump -t unique-type.dylib
> ...
> 0000000000000304      d  *UND* __ZL3barii
> ...
> 0000000000000328      d  *UND* __ZL3barii.1
> ...
> ```
> 
> What would be better to do in such case, if DISubprogram uniquing is assumed?

An alternative solution for that could be, to maintain DISubprogram's linkageName up-to-date with llvm::Function name, and to maintain the list of DISubprogram's retianedNodes in MetadataLoader.

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


More information about the llvm-commits mailing list