.llvm.callgraph Section Layout

The .llvm.callgraph section is used to store call graph information for each function. The section contains a series of records, with each record corresponding to a single function.

Per Function Record Layout

Each record in the .llvm.callgraph section has the following binary layout:

FieldTypeSize (bits)Description
Format Versionuint8_t8The version of the record format. The current version is 0.
Flagsuint8_t8A bitfield where: Bit 0 is set if the function is a potential indirect call target; Bit 1 is set if there are direct callees; Bit 2 is set if there are indirect callees. The remaining 5 bits are reserved.
Function Entry PCuintptr_t32/64The address of the function's entry point.
Function Type IDuint64_t64The type ID of the function. This field is non-zero if the function is a potential indirect call target and its type is known.
Number of Unique Direct CalleesULEB128VariableThe number of unique direct call destinations from this function. This field is only present if there is at least one direct callee.
Direct Callees Arrayuintptr_t[]VariableAn array of unique direct callee entry point addresses. This field is only present if there is at least one direct callee.
Number of Unique Indirect Target Type IDsULEB128VariableThe number of unique indirect call target type IDs. This field is only present if there is at least one indirect target type ID.
Indirect Target Type IDs Arrayuint64_t[]VariableAn array of unique indirect call target type IDs. This field is only present if there is at least one indirect target type ID.