asmjit::LabelEntry Class Reference
Inheritance diagram for asmjit::LabelEntry:
asmjit::ZoneHashNode

Label entry.

Contains the following properties:

  • Label id - This is the only thing that is set to the Label operand.
  • Label name - Optional, used mostly to create executables and libraries.
  • Label type - Type of the label, default LabelType::kAnonymous.
  • Label parent id - Derived from many assemblers that allow to define a local label that falls under a global label. This allows to define many labels of the same name that have different parent (global) label.
  • Offset - offset of the label bound by Assembler.
  • Links - single-linked list that contains locations of code that has to be patched when the label gets bound. Every use of unbound label adds one link to _links list.
  • HVal - Hash value of label's name and optionally parentId.
  • HashNext - Hash-table implementation detail.

Public Members

Members
- Public Attributes inherited from asmjit::ZoneHashNode

Public Types

Constants

Member Functions

Accessors
- Public Member Functions inherited from asmjit::ZoneHashNode

Member Enumeration Documentation

anonymous enum : uint32_t◆ 

ConstantDescription
kStaticNameSize 

SSO size of _name.

Member Function Documentation

uint32_t LabelEntry::id() constnoexcept◆ 

Returns label id.

void LabelEntry::_setId(uint32_t id)noexcept◆ 

Sets label id (internal, used only by CodeHolder).

LabelType LabelEntry::type() constnoexcept◆ 

Returns label type.

bool LabelEntry::hasParent() constnoexcept◆ 

Tests whether the label has a parent label.

uint32_t LabelEntry::parentId() constnoexcept◆ 

Returns label's parent id.

Section* LabelEntry::section() constnoexcept◆ 

Returns the section where the label was bound.

If the label was not yet bound the return value is nullptr.

bool LabelEntry::hasName() constnoexcept◆ 

Tests whether the label has name.

const char* LabelEntry::name() constnoexcept◆ 

Returns the label's name.

Note
Local labels will return their local name without their parent part, for example ".L1".

uint32_t LabelEntry::nameSize() constnoexcept◆ 

Returns size of label's name.

Note
Label name is always null terminated, so you can use strlen() to get it, however, it's also cached in LabelEntry itself, so if you want to know the size the fastest way is to call LabelEntry::nameSize().

LabelLink* LabelEntry::links() constnoexcept◆ 

Returns links associated with this label.

bool LabelEntry::isBound() constnoexcept◆ 

Tests whether the label is bound.

bool LabelEntry::isBoundTo(Section* section) constnoexcept◆ 

Tests whether the label is bound to a the given sectionId.

uint64_t LabelEntry::offset() constnoexcept◆ 

Returns the label offset (only useful if the label is bound).

uint32_t LabelEntry::hashCode() constnoexcept◆ 

Returns the hash-value of label's name and its parent label (if any).

Label hash is calculated as HASH(Name) ^ ParentId. The hash function is implemented in Support::hashString() and Support::hashRound().

Member Data Documentation

LabelType LabelEntry::_type◆ 

Type of the label.

uint8_t LabelEntry::_reserved[3]◆ 

Must be zero.

uint32_t LabelEntry::_parentId◆ 

Label parent id or zero.

uint64_t LabelEntry::_offset◆ 

Label offset relative to the start of the _section.

Section* LabelEntry::_section◆ 

Section where the label was bound.

LabelLink* LabelEntry::_links◆ 

Label links.

ZoneString<kStaticNameSize>LabelEntry::_name◆ 

Label name.