25.6.9 Pinned Structs

Pinned structs is a convenient way to write struct types where the offset of all its fields is zero. They are equivalent to C unions.

For example, consider the _u field below in a CTF type description:

type Ctf_Stype_V1 =
  struct
  {
    Ctf_Name ctt_name;
    Ctf_Info_V1 ctt_info;
    pinned struct
    {
      uint32 _size;		/* Size of entire type in bytes.  */
      uint32 _type;		/* Reference to another type.  */
    } _u;
  };

Note that integral structs cannot be pinned. See Integral Structs. And field labels are not allowed in pinned structs.