brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 45d0657 Raw
34 lines · plain
1====================2Callee Type Metadata3====================4 5Introduction6============7This ``!callee_type`` metadata is introduced to support the generation of a call graph8section in the object file.  The ``!callee_type`` metadata is used9to identify the types of the intended callees of indirect call instructions. The ``!callee_type`` metadata is a10list of one or more generalized ``!type`` metadata objects (See :doc:`TypeMetadata`) with each ``!type``11metadata pointing to a callee's :ref:`type identifier <calleetype-type-identifier>`.12LLVM's `Control Flow Integrity (CFI)`_ also uses the ``!type`` metadata in its implementation.13 14.. _Control Flow Integrity (CFI): https://clang.llvm.org/docs/ControlFlowIntegrity.html15 16.. _calleetype-type-identifier:17 18Type identifier19================20 21The type for an indirect call target is the callee's function signature.22Mapping from a type to an identifier is an ABI detail.23In the current implementation, an identifier of type T is24computed as follows:25 26  -  Obtain the generalized mangled name for “typeinfo name for T”.27  -  Compute MD5 hash of the name as a string.28  -  Reinterpret the first 8 bytes of the hash as a little-endian 64-bit integer.29 30To avoid mismatched pointer types, generalizations are applied.31Pointers in return and argument types are treated as equivalent as long as the qualifiers for the 32type they point to match. For example, ``char*``, ``char**``, and ``int*`` are considered equivalent33types. However, ``char*`` and ``const char*`` are considered distinct types.34