You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `.callgraph` section is used to store call graph information for each function, which can be used for post-link analyses and optimizations. The section contains a series of records, with each record corresponding to a single function.
4
+
5
+
For efficiency, we make a distinction between direct and indirect call data. For direct calls, we record the unique callees, not the location of each individual call. For indirect calls, we record the location of each call site and the type ID of the callee. Post link analysis scripts which utilize this information to reconstuct the program call graph can potentially receive more information regarding indirect callsites from the user to improve the precision of the call graph.
6
+
7
+
## Per Function Record Layout
8
+
9
+
Each record in the `.callgraph` section has the following binary layout:
| Format Version |`uint32_t`| 32 | The version of the record format. The current version is 0. |
14
+
| Function Entry PC |`uintptr_t`| 32/64 | The address of the function's entry point. |
15
+
| Function Kind |`uint8_t`| 8 | An enum indicating the function's properties (e.g., if it's an indirect call target). |
16
+
| Function Type ID |`uint64_t`| 64 | The type ID of the function. This field is **only** present if `Function Kind` is `INDIRECT_TARGET_KNOWN_TID`. |
17
+
| Number of Indirect Callsites |`uint32_t`| 32 | The number of indirect call sites within the function. |
18
+
| Indirect Callsites Array |`Callsite[]`| Variable | An array of `Callsite` records, with a length of `Number of Indirect Callsites`. |
19
+
| Number of Unique Direct Callees |`uint32_t`| 32 | The number of unique direct call destinations from this function. |
20
+
| Direct Callees Array |`uintptr_t[]`| Variable | An array of unique direct callee entry point addresses, with a length of `Number of Direct Callees`. |
21
+
22
+
### Indirect Callsite Record Layout
23
+
24
+
Each record in the `Indirect Callsites Array` has the following layout:
0 commit comments