[llvm-dev] Function name

via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 26 08:27:44 PDT 2018


Hi Muhui,

I believe the names in the callgraph are the "mangled" name, which DWARF refers to as the linkage name.  This would be recorded in the DW_AT_MIPS_linkage_name or DW_AT_linkage_name attribute, depending on the version of DWARF.

DW_AT_specification is a way to associate two DWARF entries for the same entity.  You will see this most commonly for inlined functions, where the DWARF entry for the inlined instance has a DW_AT_specification pointing to the "abstract" instance for the same function.  This is intended as a space-saving tactic, as many of the attributes for a function (including its linkage name) are the same across all inlined instances.  The abstract instance has the common attributes, while the concrete instances have the attributes specific to each inlined instance (e.g., code ranges).

As for the PLT segment, I suspect that DWARF does not describe these because they are artifacts of the ABI and do not reflect anything in the source.  The callgraph describes them because they are explicit in the IR.
--paulr

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Muhui Jiang via llvm-dev
Sent: Thursday, October 25, 2018 4:16 PM
To: llvm-dev
Subject: [llvm-dev] Function name

Hi

I refer to the binary generated by C++ code.

I am curious about the name inside the callgraph, which is generated by the tool

opt -dot-callgraph target.bc

I found the names inside the callgraph follow the C++ function name rule. Then I would like to check the name inside the debugging information, which is generated by the command

llvm-dwarfdump -debug-info target.o

I manually checked it, I found sometimes the name(label in the callgraph) is the attribute of `DW_AT_specification`, sometimes is `DW_AT_MIPS_linkage_name`. Can anyone explain these? What should be the right function name inside the dwarf debugging information?

Another question is about the PLT segment. I found that the callgraph will contain the functions inside the ELF PLT segment while the dwarf debugging information does not contain them. Could anyone explain these? Many Thanks

Regards
Muhui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181026/8ba2fada/attachment-0001.html>


More information about the llvm-dev mailing list