Skip to main content

Module classes

Module classes 

Source
Expand description

C++ classes from an image’s run-time type information, under the Itanium C++ ABI (§2.5 virtual tables, §2.9.5 type_info objects), ELF images of 64-bit machines (x86-64, AArch64): the program’s Classes.

  • type_info objects: a _ZTI<type> symbol, or by shape where a virtual table points to one: its second word points to its name string, a mangled class type (5Shape, _ZTS and the string parsing as typeinfo name for a class). Its layout says its bases: __si_class_type_info (24 bytes: one public non-virtual base at offset 0, the pointer at +16) and __vmi_class_type_info (flags at +16, the base count at +20, then per base its type_info and its offset and flags: offset >> 8, bit 0 virtual), by the symbol’s size where it has one, else by shape (+16 points to a type_info: one base; else a count from 1 to 255 whose first base is one). A base whose type_info the image does not define (an import’s) is not known. The primary base is the first non-virtual base at offset 0.
  • Virtual tables: a _ZTV<class> symbol, or by shape a word 0 (the offset to top of a primary table) followed by a pointer to a class’s type_info and at least one pointer to code. The address point is past those two words; the slots are the words from there that point to code or are unknown (a relocation against another module’s symbol: __cxa_pure_virtual) where code follows, up to the symbol’s end and before the next table of the group (a non-zero offset to top followed by the same type_info: a secondary table, not read). A table whose type_info pointer is unknown (a relocation against an interposable symbol, as in a shared library) is its symbol’s class; a base whose pointer is unknown is not known.
  • Methods: a function whose mangling is a member of a class of the table (its scope renders as the class’s name) and that is a slot of some primary table (virtual, so never static), or that is a constructor or destructor of it, takes that class’s this; a slot with no such mangling, the join of the classes whose tables hold it (stripped: an inherited method sits in every derived table).
  • Slot names: the last component of the slot function’s mangling (a destructor destructor, a deleting one deleting_destructor, operators none).

Words are read from memory the program cannot change once loaded (ImageMemory: a relocated slot’s known value), so tables in writable data are not read.

Functions§

classes
The C++ classes of image (see the module); none for other formats and machines.